Animating a Line2D

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By psear

I’m trying to do something straightforward, so I feel like there must be a straightforward answer.

I have a grid with lots of lines, and I’m animating them sequentially, in a sort of fancy effect. The grid is build up of many Line2Ds, each with 2 points. When I put the key frame in the animator, and then a second key frame, I can’t animate the position of an individual point on the Line2D, I can only animate the Points property. When I try that, I manually change the values of the coordinates for each of the lines, but instead of animating them, it just goes straight from the initial point to the final point at the end of the animation.

I have a feeling it has something to do with the fact that the animation player can’t interpolate the Line2Ds Points property, because it’s an array.

I’d imagine there’s a way to do this with interpolate_method on a bunch of tweens, but that’s going to get really, really messy, considering I’m animating about 18 lines and 81 cells between them.

What would be the best way to go about this?

:bust_in_silhouette: Reply From: psear

Putting an answer here. As it turned out, it was very straightforward. I hadn’t set the animation to “continuous” in the timeline, once I did that it animated as expected.

I got caught by this attempting to animate a Line2D
Thank you for posting your solution.

brok3nrob0t | 2023-05-28 09:33

1 Like

I made a godot account just to reply, thank you for posting how you solved this bc if I didnt see this, I feel this wouldve left me stumped for hours