Scenes should track cumulative time since starting #2776
Replies: 12 comments
-
Agreed with the general point. One nitpick: I would rather see a complete overhaul of ValueTracker before we inherit anything from it. Every single use of ValueTracker I've seen seems unnecessarily clunky... |
Beta Was this translation helpful? Give feedback.
-
What sort of clunkiness are you trying to avoid? |
Beta Was this translation helpful? Give feedback.
-
I support this venture. Seems helpful for the So there's the basic part: using it the first time is an error off the bat: class AudioTest(Scene):
def construct(self):
group_dots = VGroup(*[Dot() for _ in range(3)])
group_dots.arrange_submobjects(RIGHT)
for dot in group_dots:
self.add_sound("generic_sound.wav")
self.play(FadeIn(dot))
self.wait()
File "C:\Users\User\ManimCommunity\manim\scene\scene.py", line 861, in add_sound
time = self.time + time_offset
AttributeError: 'AudioTest' object has no attribute 'time' So I take care of that by changing The animation actually plays well, with the sound in sync with the dots AudioTest.mp4Good tidings and fortune right? A man does a rerun: AudioTest.mp4After I toy with something in AudioTest.mp4So the sound is not in sync. Hence caching affects the time count. How exactly? I spoke with my debugger: 1. Without caching. Note the number of frames on the left hand side
2. With cachingConsidering
|
Beta Was this translation helpful? Give feedback.
-
@NeoPlato is right, this is already being done in |
Beta Was this translation helpful? Give feedback.
-
Scene caching does change it, but if the scene is cached anyway maybe that isn't a problem? |
Beta Was this translation helpful? Give feedback.
-
Would that ensure the frames get updated correctly even with caching? |
Beta Was this translation helpful? Give feedback.
-
The renderer time is updated in https://github.com/ManimCommunity/manim/blob/master/manim/renderer/cairo_renderer.py#L144 |
Beta Was this translation helpful? Give feedback.
-
Oh it skips the entire thing? That makes sense. So you would have a separate construct that updates the frame from the |
Beta Was this translation helpful? Give feedback.
-
I'd like to take up this issue but since I havent worked on this project before a few pointers might help to start with this issue |
Beta Was this translation helpful? Give feedback.
-
@Hari-07 thank you for volunteering! What kind of pointers are you looking for? If you start your work and come across a concrete doubt, don't hesitate to ask here or on our discord. |
Beta Was this translation helpful? Give feedback.
-
Hi @Hari-07 , are you still willing to work on this? If you don't manifest, I think I'll do it. As @eulertour said Taking the elapsed time from the renderer is a bad idea when a scene is skipped for some reason. Instead, we could when an animation is skipped add its time to an internal clock of the Scene. |
Beta Was this translation helpful? Give feedback.
-
Yeah sure you can take it, I got engrossed in other side projects and
forgot about this to be honest
…On Tue, Jan 26, 2021 at 5:44 PM Hugues Devimeux ***@***.***> wrote:
Hi @Hari-07 <https://github.com/Hari-07> , are you still willing to work
on this? If you don't manifest, I think I'll do it.
As @eulertour <https://github.com/eulertour> Taking the elapsed time from
the renderer is a bad idea when a scene is skipped for some reason.
Instead, we could when a scene is skipped add its time to an internal
clock of the Scene.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#851 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFKWGRZLSOO7P3BSGAYQDZ3S32W35ANCNFSM4UTB4R3A>
.
|
Beta Was this translation helpful? Give feedback.
-
Description of proposed feature
Scenes should store the total time since starting and make this value accessible via a public API.
How can the new feature be used?
There isn't currently a way to update mobjects based on the cumulative elapsed time since a given start point. Time based updaters only pass
dt
, the incremented time, which leaves the user to add that value to a running total manually in order to track cumulative time. This makes things like animating a continually growing angle unnecessarily complex.It may be best to also add a new Clock class which inherits from ValueTracker and has APIs like
Scene.get_clock()
,Clock.start()
, andClock.stop()
.Beta Was this translation helpful? Give feedback.
All reactions