r/manim • u/playsthebongcloud • 1d ago
question How can I fix this animation so that "f" moves to the right?
The editing isn't finished, don't worry that it just generally kind of looks bad and it gets cut off, that's not my issue right now. The problem is that f doesn't go to the left when "x" is transformed to "TheVariableBeingSquared", then it awkwardly snaps back to it.
I'm looking for either
- a way to fix the transform to "TheVariableBeingSquared" to the right of "f", even while it's being transformed, or
- a way to fix "f" to the left of the transform to "TheVariableBeingSquared" while it's being transformed
Both are equivalent, since I can just keyframe it in place using the editing software.
Here's my code:
f = MathTex(r'f', font_size=60)
eq = MathTex(r'(x)=x^{2}', font_size=60)
eq.always.next_to(f, RIGHT, buff=0.1)
self.play(Write(f, run_time=0.3), Write(eq, run_time=1.6))
self.wait(5.25)
self.play(Transform(f, MathTex(r'\text{ThisFunctionIsEqualToXSquared}', font_size=60)))
self.wait(10.31666)
self.play(Transform(f, MathTex(r'f', font_size=60), run_time=0.6833333))
self.wait(5.0333)
self.play(Transform(f, MathTex(r'f', font_size=30)), Transform(eq, MathTex(r'(\text{TheVariableBeingSquared})=\text{TheVariableBeingSquared}^{2}', font_size=30)))
self.wait(30)