ManimCommunity / ManimCommunity/manim

Extra frame of animation with dt-updater

Open
#4,611 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description of bug / unexpected behavior

Playing animations with the dt-updater added results in duplicate frames. This issue is especially noticeable at low FPS or when using TracedPath.

Code for reproducing the problem
config.frame_rate = 5
class DtUpdaterBug(Scene):
    def construct(self):
        circle = Circle().set_fill(RED, 1).to_edge(LEFT)

        def upd_circle(mob, dt):
            mob.shift(2 * dt * RIGHT)

        def upd_cnt(cnt, dt):
            cnt.increment_value(dt * config.frame_rate)

        counter = Integer().shift(UP * 2).add_updater(upd_cnt)
        circle.add_updater(upd_circle)
        self.add(counter, circle)
        self.wait(2)
        error = Text("Error: extra frame for every animation")
        self.add(error.to_edge(UP).scale(0.6))
        for _ in range(5):
            self.play(Animation(VMobject()), run_time=1 / 5)
            self.wait(3 / 5)
        self.remove(error)
        self.wait(2)

Additional comments

https://discord.com/channels/1453870851807117363/1463725322313666655

https://github.com/user-attachments/assets/9dcc85bb-1c00-4570-8933-3853fe10c868

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 running the provided DtUpdaterBug reproduction with config.frame_rate set to 5, focusing on the dt updaters, Animation(VMobject()), and wait calls. Trace how animation and updater frames are advanced, then verify that the repeated play/wait sequence produces no duplicate frames, including when TracedPath is used.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.