#概要
manimの作法、調べてみた。
Animation、使ってみた。
#サンプルコード
from manimlib.imports import *
class FuncRotater(Animation):
CONFIG = {
"rev_func" : lambda x : x,
}
def interpolate_submobject(self, submobject, starting_submobject, alpha):
submobject.points = np.array(starting_submobject.points)
def interpolate_mobject(self, alpha):
Animation.interpolate_mobject(self, alpha)
angle_revs = self.rev_func(alpha)
self.mobject.rotate(angle_revs * TAU, about_point = ORIGIN)
class test(Scene):
def construct(self):
circle = Circle()
dot = Dot()
dot2 = dot.copy().shift(RIGHT)
self.play(GrowFromCenter(dot))
self.wait()
self.play(Transform(dot, dot2))
self.wait()
self.play(MoveAlongPath(dot, circle), run_time = 1, rate_func = linear)
self.wait()
self.play(Rotating(dot, about_point = [2, 0, 0]), run_time = 1)
self.wait()
self.play(FuncRotater(dot, rev_func = lambda x : x % 0.25, run_time = 2))
self.wait()
self.play(ApplyMethod(dot.scale, 2))
self.wait()
self.play(FadeOut(dot))
self.wait()
#生成した動画
以上。