I checked manim's method. I tried using 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()
https://www.youtube.com/watch?v=0aBAezBXB-w
that's all.
Recommended Posts