期待已久的 AI 演示动画制作终于来了!

期待已久的 AI 演示动画制作终于来了!

AI 部分:
https://www.yeschat.ai/gpts-9t55kXPlnZ0-Manim-Engineer

动画引擎:
https://docs.manim.community/en/stable/examples.html

然后可以在线测试:
https://try.manim.community/

3 x ⭕️ = 36,求 ⭕️,如何让 2 年级小朋友能做出来?比如我想用动画演示拆分计算过程。很简单:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
完整代码:

%%manim -qm SolveEquationWithBricks

class SolveEquationWithBricks(Scene):
    def construct(self):
        # Set the background color to olive green
        self.camera.background_color = "#385723"
        
        # Title
        title = MathTex("3 \\cdot x = 36").scale(1.5).to_edge(UP)
        self.play(Write(title))
        
        # Step 1: Split 36 into 30 and 6
        split_text = MathTex("36 = 30 + 6").scale(1.2).to_edge(UP, buff=1.5)
        self.play(Write(split_text))
        
        # Step 2: Represent 30 with bricks (10 each row)
        brick_color = RED
        brick_30 = VGroup(
            *[Square(side_length=0.3, color=brick_color, fill_opacity=0.7)
              for _ in range(30)]
        ).arrange_in_grid(rows=3, cols=10, buff=0.1).shift(UP * 1.5 + LEFT * 2)
        
        label_30 = MathTex("30").next_to(brick_30, LEFT)
        self.play(FadeIn(brick_30), Write(label_30))
        
        # Step 3: Represent 6 with bricks
        brick_6 = VGroup(
            *[Square(side_length=0.3, color=YELLOW, fill_opacity=0.7)
              for _ in range(6)]
        ).arrange_in_grid(rows=3, cols=2, buff=0.1).next_to(brick_30, RIGHT, buff=2)
        
        label_6 = MathTex("6").next_to(brick_6, RIGHT)
        self.play(FadeIn(brick_6), Write(label_6))
        
        # Step 4: Divide 30 into 3 groups of 10
        group_10 = VGroup(
            VGroup(*brick_30[:10]),
            VGroup(*brick_30[10:20]),
            VGroup(*brick_30[20:])
        )
        
        div_arrow_30 = MathTex("\\div 3 = 10").next_to(brick_30, DOWN, buff=1)
        self.play(group_10[0].animate.shift(LEFT * 3),
                  group_10[1].animate.shift(ORIGIN),
                  group_10[2].animate.shift(RIGHT * 3),
                  Write(div_arrow_30))
        
        # Step 5: Divide 6 into 3 groups of 2
        group_2 = VGroup(
            VGroup(*brick_6[:2]),
            VGroup(*brick_6[2:4]),
            VGroup(*brick_6[4:])
        )
        
        div_arrow_6 = MathTex("\\div 3 = 2").next_to(brick_6, DOWN, buff=1)
        self.play(group_2[0].animate.shift(LEFT * 2),
                  group_2[1].animate.shift(ORIGIN),
                  group_2[2].animate.shift(RIGHT * 2),
                  Write(div_arrow_6))
        
        # Step 6: Add 10 and 2 to get x = 12
        final_result = MathTex("x = 10 + 2 = 12").scale(1.5).to_edge(DOWN)
        self.play(Write(final_result))
        
        self.wait(2)

把上面生成的代码,放到 Jupyter 里运行:
在这里插入图片描述
动画就出来了!


resource: https://www.reddit.com/r/manim/comments/11z2p4n/generative_manim_an_experiment_to_generate_manim/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值