[PYTHON] Manim's method 11

Overview

I checked manim's method. I tried using Animation.

Sample code

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()


Generated video

https://www.youtube.com/watch?v=0aBAezBXB-w

that's all.

Recommended Posts

Manim's method 7
Manim's method 13
Manim's method 2
Manim's method 18
Manim's method 17
Manim's method 5
Manim's method 15
Manim's method 11
Manim's method 16
Manim's method 20
Manim's method 10
Manim's method 9
Manim's method 6
Manim's method 21
Manim's method 4
Manim's method 8
Manim's method 14
Manim's method 22
Manim's method 19
Manim's method 12
manim's manners
Binary method
Special method
Special method
Understand k-means method
Dictionary items method
[PyTorch] Installation method
N cross method
Image collection method
Regression analysis method
Gradient method implementation 1
Python-peewee connection method
Class method static method
youtube-dl update method
Monte Carlo method
Mode-Matching Method Simulation_Python
Johnson method (python)
[Python] Semi-Lagrange method