'Unable to shorten flow field vectors

I have this program where I'm trying to make a flow field. I wanted to use the vectors I use to make the noise to be available for the particles moving through the flow field, so they can use it to accomplish that. But I'm running into a problem: my flow field lines are very lenghty: enter image description here

I'm doing soemthing like this: enter image description here

And I'm unable to shorten the vector used to discover the dynamic vertex position. Does someone know how to achieve this?



Solution 1:[1]

So I figured it out. I just had to multiply the vector by a number using a scale function, like so:

const noiseVec = scale(GRID_LINE_SCL, normalize(vec2(Math.cos(noiseValue), Math.sin(noiseValue))));

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kob