Help animate the dotted line

Hi) How to animate a dashed line so that it travels along the main line? thank

dotted line.3dm (63.2 KB) dotted line.gh (4.0 KB)

Thinking out loud:
Could you use linetype dashed and then split the polyline in two based on it distance from start to end and animate the split point?

Hi @sambrari95,

You can for instance move the curve seam to move the dashed line. In order to animate the movement, simply displace the curve seam with for instance a counter or even an animated slider (to export the animation frames).

Since the latest version of Kangaroo2 unfortunately doesn’t come with the Counter component anymore, I’ve attached my custom Python counter.
You can play with it’s parameters to change the animation speed!
The Mod (Modulor) component makes it that if the counter reaches 1, it goes back to 0.

dotted line animated.gh (9.5 KB)

Have fun!

7 Likes

thank

If you have access to Rhino 7 WIP, you can use GhGL:

#Vertex
layout(location = 0) in vec3 vertex;
layout(location = 1) in float t;

uniform mat4 _worldToClip;
out vec4 vertex_color;
uniform float _time;
uniform float speed;
uniform float repeat;

void main() {
  vertex_color.r = sin(repeat * (t + _time * speed));
  gl_Position = _worldToClip * vec4(vertex, 1.0);
}
#Fragment

in vec4 vertex_color;
out vec4 fragment_color;

void main() {
  fragment_color = vertex_color;
  if (fragment_color.r > 0) {
      discard;
  }
}

GhGl.gh (6.3 KB)

4 Likes

is it possible to somehow change the thickness of the dotted lines?

If you just want to increase the thickness for display purposes, you can use PreviewLW (Custom Preview Lineweights) from the Human plugin.
Otherwise, you can use Pipe, or MPipe (Mesh Pipe) from MeshTools to thicken the line segments. MPipe will be faster than Pipe.

1 Like

thank you very much friend