Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion manim/animation/composition.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ def _setup_scene(self, scene) -> None:
anim._setup_scene(scene)

def finish(self) -> None:
self.interpolate(1)
for anim in self.animations:
anim.finish()
self.anims_begun[:] = True
self.anims_finished[:] = True
if self.suspend_mobject_updating:
Expand Down
18 changes: 18 additions & 0 deletions tests/module/animation/test_composition.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,24 @@ def test_animationgroup_is_passing_remover_to_nested_animationgroups():
assert polygon_animation.remover


def test_animationgroup_calls_finish():
class MyAnimation(Animation):
def __init__(self, mobject):
super().__init__(mobject)
self.finished = False

def finish(self):
self.finished = True

scene = Scene()
sqr_animation = MyAnimation(Square())
circ_animation = MyAnimation(Circle())
animation_group = AnimationGroup(sqr_animation, circ_animation)
scene.play(animation_group)
assert sqr_animation.finished
assert circ_animation.finished


def test_empty_animation_group_fails():
with pytest.raises(ValueError, match="Please add at least one subanimation."):
AnimationGroup().begin()
Expand Down
Loading