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
```py
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
Hello, we've tried to reproduce the problem but could not successfully find any differences between having wait() and not, would you be able to clarify the issue?
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
```py 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