You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
772 B
18 lines
772 B
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)
|