manim_zh_doc
  • 如何安装manim
  • 快速使用
  • 最佳实践
    • Basic Concepts
      • ManimCELogo
      • BraceAnnotation
      • VectorArrow
      • GradientImageFromArray
      • BooleanOperations
    • Animations
      • PointMovingOnShapes
      • MovingAround
      • MovingAngle
      • MovingDots
      • MovingGroupToDestination
      • MovingFrameBox
      • RotationUpdater
      • PointWithTrace
    • Plotting
      • SinAndCosFunctionPlot
      • ArgMinExample
      • GraphAreaPlot
      • PolygonOnAxes
      • HeatDiagramPlot
  • 教程 And 指导
    • 快速使用
      • 概述
      • 新建Project
      • 制作动画
      • 解释
      • 正方形转换圆
      • 定位Mobject
      • 使用.animate语法进行动画处理
      • Transform与ReplacementTransform
    • 输出设置
      • Manim 输出文件夹
      • 章节
      • 命令行标志
    • Manim 的构建块
      • Mobjects
        • 创建和显示 mobjects
        • 放置 mobjects
        • 设置 mobject 的样式
        • Mobject 屏幕顺序
      • 动画
        • 制作方法动画
        • 动画运行时间
        • 创建自定义动画
        • 使用 mobject 的坐标
        • 将 mobject 转换为其他 mobject
      • 场景
  • 进阶指南
    • 配置
      • 命令行参数
        • 高级示例
        • 所有 CLI 标志的列表
      • ManimConfig 类
      • 配置文件
    • 深入了解 Manim 的内部结构
      • 介绍
      • 概述
      • Page
Powered by GitBook
On this page
  1. 教程 And 指导
  2. Manim 的构建块
  3. 动画

制作方法动画

任何可以更改的 mobject 属性都可以被动画化。事实上,任何改变 mobject 属性的方法都可以用作动画,通过使用 :meth:'.animate'。

class AnimateExample(Scene):
    def construct(self):
        square = Square().set_fill(RED, opacity=1.0)
        self.add(square)

        # animate the change of color
        self.play(square.animate.set_fill(WHITE))
        self.wait(1)

        # animate the change of position and the rotation at the same time
        self.play(square.animate.shift(UP).rotate(PI / 3))
        self.wait(1)

:meth:'.animate' 是所有 mObjects 的一个属性,它使出现的方法产生动画效果 然后。 例如,设置square.set_fill(WHITE)正方形的填充颜色,同时square.animate.set_fill(WHITE)为此作添加动画效果。

Previous动画Next动画运行时间

Last updated 22 days ago