ManimCommunity / ManimCommunity/manim
wait() messes with DecimalNumber position in updater
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
In the tutorial Manim's building blocks, section Animations subsection Creating a custom animation, in the scene CountingScene, the updater which is supposed to center the number doesn't work (see the animation rendered on the page).
Expected behavior
The updater (lambda number: number.move_to(ORIGIN)) does not work until the play() animation is finished. Weirdly enough, removing the first self.wait() solves the problem.
How to reproduce the issue
Code for reproducing the problem, copy pasted from the tutorial page
from manim import *
class Count(Animation):
def __init__(self, number: DecimalNumber, start: float, end: float, **kwargs) -> None:
# Pass number as the mobject of the animation
super().__init__(number, **kwargs)
# Set start and end
self.start = start
self.end = end
def interpolate_mobject(self, alpha: float) -> None:
# Set value of DecimalNumber according to alpha
value = self.start + (alpha * (self.end - self.start))
self.mobject.set_value(value)
class CountingScene(Scene):
def construct(self):
# Create Decimal Number and add it to scene
number = DecimalNumber().set_color(WHITE).scale(5)
# Add an updater to keep the DecimalNumber centered as its value changes
number.add_updater(lambda number: number.move_to(ORIGIN))
self.add(number)
self.wait()
# Play the Count Animation to count from 0 to 100 in 4 seconds
self.play(Count(number, 0, 100), run_time=4, rate_func=linear)
self.wait()
Additional media files
MP4 file
After removing the first self.wait():
https://github.com/user-attachments/assets/1f9eed72-32b6-48f6-90ee-5070c7b94519
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproduced CountingScene from the issue and render it with the initial self.wait() present. Compare the DecimalNumber updater behavior during wait() and Count, then trace the relevant updater and animation execution paths. Done means the updater keeps the number centered while the Count animation runs, without breaking the tutorial example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100