Animate fat dashed lines

Is it possible to add animation to these dashed fat lines? Moving the points in one of the two directions.


https://threejs.org/examples/?q=lines#webgl_lines_fat

Hi!
What animation do you mean?

Sorry. Moving the points in one of the two directions.

Points? Do you mean vertices of the geometry? Or these dashes have to move along the line?

The dashes have to move along the line

Do you have a woking live code example? jsfiddle, codepen, codesandbox etc.

If you want I can try to import this in codepen.
https://threejs.org/examples/?q=lines#webgl_lines_fat

Would be cool, if you make a working example with the extracted part for fat lines.

Do you think is possible to achieve it? If so, do you have any guidance for me? Iā€™d like to try it but Iā€™m a bit lost.

I would start with looking at the source code of fragment shader, use .onBeforeCompile, add a uniform for time, and change this line mod( vLineDistance, dashSize + gapSize ) to mod( vLineDistance + time, dashSize + gapSize ).

3 Likes