TransformMatchingTex¶
限定名称: manim.animation.transform\_matching\_parts.TransformMatchingTex
- 类 TransformMatchingTex(mobject=None, *args, use_override=True, **kwargs)[来源]¶
基类:
TransformMatchingAbstractBase
一种尝试转换渲染的 LaTeX 字符串的变换。
如果两个子对象的
tex_string
匹配,则它们匹配。另请参阅
示例
示例:匹配方程部分 ¶
from manim import * class MatchingEquationParts(Scene): def construct(self): variables = VGroup(MathTex("a"), MathTex("b"), MathTex("c")).arrange_submobjects().shift(UP) eq1 = MathTex("{{x}}^2", "+", "{{y}}^2", "=", "{{z}}^2") eq2 = MathTex("{{a}}^2", "+", "{{b}}^2", "=", "{{c}}^2") eq3 = MathTex("{{a}}^2", "=", "{{c}}^2", "-", "{{b}}^2") self.add(eq1) self.wait(0.5) self.play(TransformMatchingTex(Group(eq1, variables), eq2)) self.wait(0.5) self.play(TransformMatchingTex(eq2, eq3)) self.wait(0.5)
class MatchingEquationParts(Scene): def construct(self): variables = VGroup(MathTex("a"), MathTex("b"), MathTex("c")).arrange_submobjects().shift(UP) eq1 = MathTex("{{x}}^2", "+", "{{y}}^2", "=", "{{z}}^2") eq2 = MathTex("{{a}}^2", "+", "{{b}}^2", "=", "{{c}}^2") eq3 = MathTex("{{a}}^2", "=", "{{c}}^2", "-", "{{b}}^2") self.add(eq1) self.wait(0.5) self.play(TransformMatchingTex(Group(eq1, variables), eq2)) self.wait(0.5) self.play(TransformMatchingTex(eq2, eq3)) self.wait(0.5)
方法
get_mobject_key
get_mobject_parts
属性
运行时间
- 参数: