Manim文档及源码笔记-CE教程BE03英文笔记速览版

Manim文档及源码笔记-CE教程BE03英文笔记速览版

Animation Deep Dive _ Mathematical Animations WITH EASE

前言

这次筛选到了Behackl博士的教程,逐步拆解,更为细腻~
参考视频在此【或请自行搜索上面的英文标题】;
本页中文版传送门【建设中】;

更新【new】:

  • 8月23日
    • 文首标注了“前言”与“正文”;
    • 本系列暂告段落,升级了系列目录,放到了文尾;
  • 后续更新备忘:文中“【建设中】”的内容;欢迎朋友们催更~

首先,国际通则:Just GET STARTED~ JUST DO IT~
此图来自相关网络,侵删

然后,让我们行动起来~
注:
1、代码实践过程根据运行环境及笔记需要略有改动;
2、经过实践理解,加入了一些自己的注释;
3、常见问题及大概率解决方案:

  • Python相关:注意缩进、冒号,中英文字符、大小写;
  • Manim相关:安装与运行环境;
  • Coding相关:检查拼写;

正文

Animation Keyword Arguments

  • moject- every animation is tied to a mobject
  • run_time- the animaion’s play duration
  • rate_func- a function r: [0, 1] →[0,1] controlling animation progression
  • and some more technical, less relevant ones
%%manim -v WARNING -qm BasicAnimations
from manim import *
from colour import Color

class BasicAnimations(Scene):
    def construct(self):
        polys=VGroup(
            *[RegularPolygon(5,radius=1,fill_opacity=0.5,
            color=Color(hue=j/5,saturation=1,luminance=0.5))for j in range(5)]
        ).arrange(RIGHT)
        self.play(DrawBorderThenFill(polys),run_time=2)
        self.play(
            Rotate(polys[0],PI,rate_func=lambda t:t), # rate_func=linear
            Rotate(polys[1],PI,rate_func=smooth), # default behavior
            Rotate(polys[2],PI,rate_func=lambda t:np.sin(t*PI)), # 
            Rotate(polys[3],PI,rate_func=there_and_back), # 
            Rotate(polys[4],PI,rate_func=lambda t:1-abs(1-2*t)), # 
            run_time=2
        )
        self.wait()

BasicAnimations

BasicAnimations
看一下控制因子的图像,顺便练习一下第一章的作图:
Manim文档及源码笔记-CE教程BE01英文笔记速览版

%%manim -v WARNING -qm polys

class polys(Scene):
    def construct(self):
        ax=Axes(x_range=(-10,10),y_range=(-10,10))
        curve0=ax.plot(lambda t: t, color=RED)
        curve2=ax.plot(lambda t: np.sin(t*PI), color=GREEN)
        curve4=ax.plot(lambda t: 1-abs(1-2*t), color=PURPLE)
        self.add(ax, curve0,curve2,curve4)

polys

Basic Mechanisms of Scene.play

  • Multiple animations can be passed as positional arguments:
    self.play(anim1, anim2, …)
  • Passing animation keyword arguments propagates them to all animations:
    s
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值