ManimCommunity / ManimCommunity/manim

[BUG-General] Updaters do not behave well with t values

Open
#550 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

issue:bug
Dominant language
Python
Stars
40.9k
Forks
3.1k
Avg merge
3d 12h
Merged PRs (30d)
25

Description

Consider this scene :
```python

RUN_TIME = 1

class Test(Scene):
def construct(self):
path = VMobject()
dot = Dot()
path.set_points_as_corners([dot.get_center(), dot.get_center()])
def update_path(path):
previus_path = path.copy()
previus_path.add_points_as_corners([dot.get_center()])
path.become(previus_path)
path.add_updater(update_path)
self.add(path, dot)
self.play(Rotating(dot, radians=PI, about_point=RIGHT, run_time=RUN_TIME))
self.play(dot.shift, UP)
```
Running normally (Rotating with RUN_TIME = 1, t values = 0,1/15,2/15 etc) :
![Test](https://user-images.githubusercontent.com/36239975/96149509-b0302680-0f09-11eb-833a-065849f2e0a3.gif)

When changing RUN_TIME to 0.1. there is therefore way less t values, and :
![Test](https://user-images.githubusercontent.com/36239975/96149764-fa190c80-0f09-11eb-9c36-bfaa3cae0390.gif)
As you can see, it's not smooth at all.

When there is only one t = 1, (eg when rendering the last frame with -s ):
![Test](https://user-images.githubusercontent.com/36239975/96149927-292f7e00-0f0a-11eb-9d68-766aa2e75ff2.png)

as you can see, the updaters are updated only if there is a t value. Although this can be seen as the normal processus, it causes trouble, for example here, when scene-cacher skips an animation (the t value is directly set to the end). One gets this :

![](https://user-images.githubusercontent.com/44469195/91044310-59972200-e615-11ea-814d-99bb9e78b944.gif)

This happens as the first animation (Rotating) is cached so it uses a partial movie file instead of playing the animation. When the second animation is played the t value is directly set to 1, and manim is tricked into drawing a straight path, when there should be several points correponding to all the t values.

This is seemingly quite impossible to fix, as it would mean refactoring the whole t values thing, which .. is simple.

Related to #339

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the provided Scene with a short RUN_TIME and with the cached animation path, then trace how updater callbacks receive t values during animation and skipped frames. Done means updater-driven paths remain correct and smooth when few t values are sampled or an animation jumps directly to t=1.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-graphics
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.