Calling self.play iteratively with unequal play durations and unequal lag between plays #2856
Unanswered
GattuPattu
asked this question in
Q&A
Replies: 1 comment
-
Do you want to send an example of what your Data looks like? The "easiest" Solution as far as i can tell is for you to create paths out of your dataset and use the follow path animation. Or just calculate every single timestep for every point with the corresponding wait time. But currently there is no async Animation functionality. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am new to manim and am trying to use it to simulate the motion of point(s) in a graph. Every point begins its journey at it's origin node and traverses the graph to reach it's destination. The point trajectory and schedule (times of arrivals and departures) are pre-determined. It is a given that once a point starts moving, it doesn't stop until it reaches its destination, but also takes unequal durations to traverse the edges in its route.
I have tried to approach this simulation from many angles but nothing seems to work. For example:
I created VMobjects for every point, and created a variable
time_now
to calculate what the animation time should be, and added a real-time counter in the scene. I animated the motion edge-by-edge usingself.play(Transformation())
. I also paused program execution usingtime.sleep()
whenever there was "empty" time between successive trajectory start times. The problem with this approach is thatself.play
itself takes an unpredictable non-negligible duration of time. I tried accounting for this by recording the system time before and afterself.play
, and deducting this lost time from the next pause duration. But it is possible that the next pause duration becomes negative, ifself.play
takes too long and the next edge traversal starts too soon.This post] shows how to run multiple animations simultaneously, and this one shows how to make their start times staggered. But I can't apply this because in my case the start time (origin departure time) of every point is different, and differences between pairs of start times are also different.
This post shows how to control successive
self.play
commands. It says I can useAnimation(Mobject(),run_time=t)
to create a t-seconds pause. Let's assume I store all separate point trajectories as separate entries in a list. Then I could start these trajectory animations in ascending order of origin departure time, and create appropriate delays between successive trajectories. But I run into the same problem as (1), because every trajectory animation will take a random but significant duration. Accounting for this time loss can again cause a negative pause subsequently. Another implementation challenge would be to actually start the entire trajectory of a point as a single animation, given that different edges are traversed in different durations.Beta Was this translation helpful? Give feedback.
All reactions