manim
manim copied to clipboard
AnimationGroup height visual issue
I am trying to create a cool effect where the text is getting written and zoom in at the same time.
I tried to use the AnimationGroup object for that but this is how it renders :
https://user-images.githubusercontent.com/2827383/115975871-e9a4b700-a568-11eb-8194-fed4927fcfd2.mp4
First, the letters appear really distant from each other, small and also the height animation is being cut off, the letters come back to the original size.
The code is very simple :
class KoreanWord(Scene):
def construct(self):
t = Text('실망')
group = []
group.append(Write(t))
group.append(t.animate.set_height(2))
self.play(AnimationGroup(*group, run_time=10))
Am I doing something wrong, or is it an issue?
Thanks in advance for your help.
Try this:
class Code1498(Scene):
def construct(self):
t = Text('text')
origin_height = t.get_height()
target_height = 2
tot_time = 2
def anim(mob, dt):
mob.set_height(
mob.get_height() + \
(target_height - origin_height) / (tot_time * self.camera.frame_rate)
)
t.add_updater(anim)
self.add(t)
turn_animation_into_updater(Write(t, run_time=tot_time))
self.wait(tot_time)
t.clear_updaters()
self.wait()
https://user-images.githubusercontent.com/44120331/122313057-1a411580-cf48-11eb-906c-b19757f8fbf4.mp4