Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Slightly cleaner treatment of pi creature automatically tracking animations

Grant Sanderson4089a5a949ea
diff --git a/topics/characters.py b/topics/characters.py
index a76457879..432c30e5d 100644
--- a/topics/characters.py
+++ b/topics/characters.py
@@ -526,18 +526,17 @@ class PiCreatureScene(Scene):
lambda anim : pi_creature in anim.mobject.submobject_family(),
animations
)
- if anims_with_pi_creature:
- for anim in anims_with_pi_creature:
- if isinstance(anim, Transform):
- index = anim.mobject.submobject_family().index(pi_creature)
- target_family = anim.target_mobject.submobject_family()
- target = target_family[index]
- if isinstance(target, PiCreature):
- target.look_at(point_of_interest)
- continue
- animations.append(
- ApplyMethod(pi_creature.look_at, point_of_interest)
- )
+ for anim in anims_with_pi_creature:
+ if isinstance(anim, Transform):
+ index = anim.mobject.submobject_family().index(pi_creature)
+ target_family = anim.target_mobject.submobject_family()
+ target = target_family[index]
+ if isinstance(target, PiCreature):
+ target.look_at(point_of_interest)
+ if not anims_with_pi_creature:
+ animations.append(
+ ApplyMethod(pi_creature.look_at, point_of_interest)
+ )
return animations
def blink(self):