from manim import * class NameOfAnimation(Scene): def construct(self): #创建矩形,设置边颜色和透明度,填充颜色和透明度 box = Rectangle(stroke_color=GREEN, stroke_opacity=0.7, fill_color = RED_B, fiIl _opacity = 0.5, height=1, width=1) #无动画添加到场景中 self.add(box) #2s内向右移动两个单位 self.play(box.animate.shift(RIGHT*2), run time=2) #向上移动三个单位 self.play(box.animate.shift(UP*3), run time=2) #向下自动五个单位向左移动5个单位 self.play(box.animate.shift(DOWN*5+LEFT*5), run_time=2) #向上移动1.5单位向右移动一个单位 self.play(box.animate.shift(UP*1.5+RIGHT*1), run time=2)