mirror of
https://github.com/3b1b/manim.git
synced 2025-08-01 17:29:06 +08:00
Slightly cleaner treatment of pi creature automatically tracking animations
This commit is contained in:
@ -526,18 +526,17 @@ class PiCreatureScene(Scene):
|
|||||||
lambda anim : pi_creature in anim.mobject.submobject_family(),
|
lambda anim : pi_creature in anim.mobject.submobject_family(),
|
||||||
animations
|
animations
|
||||||
)
|
)
|
||||||
if anims_with_pi_creature:
|
for anim in anims_with_pi_creature:
|
||||||
for anim in anims_with_pi_creature:
|
if isinstance(anim, Transform):
|
||||||
if isinstance(anim, Transform):
|
index = anim.mobject.submobject_family().index(pi_creature)
|
||||||
index = anim.mobject.submobject_family().index(pi_creature)
|
target_family = anim.target_mobject.submobject_family()
|
||||||
target_family = anim.target_mobject.submobject_family()
|
target = target_family[index]
|
||||||
target = target_family[index]
|
if isinstance(target, PiCreature):
|
||||||
if isinstance(target, PiCreature):
|
target.look_at(point_of_interest)
|
||||||
target.look_at(point_of_interest)
|
if not anims_with_pi_creature:
|
||||||
continue
|
animations.append(
|
||||||
animations.append(
|
ApplyMethod(pi_creature.look_at, point_of_interest)
|
||||||
ApplyMethod(pi_creature.look_at, point_of_interest)
|
)
|
||||||
)
|
|
||||||
return animations
|
return animations
|
||||||
|
|
||||||
def blink(self):
|
def blink(self):
|
||||||
|
Reference in New Issue
Block a user