The following is my current code:
from manimlib.imports import *
class ClockOrganization(VGroup):
CONFIG = {
"numbers" : 4,
"radius" : 3.1,
"color" : WHITE
}
def __init__(self, **kwargs):
digest_config(self, kwargs, locals())
self.generate_nodes()
VGroup.__init__(self, *self.node_list,**kwargs)
def generate_nodes(self):
self.node_list = []
for i in range(self.numbers):
mobject = VMobject()
number = TexMobject(str(i+1))
circle = Circle(radius=0.4,color=self.color)
mobject.add(number)
mobject.add(circle)
mobject.move_to(
self.radius * np.cos((-TAU / self.numbers) * i + 17*TAU / 84) * RIGHT
+ self.radius * np.sin((-TAU / self.numbers) * i + 17*TAU / 84) * UP
)
self.node_list.append(mobject)
def select_node(self, node):
selected_node = self.node_list[node]
selected_node.scale(1.2)
selected_node.set_color(RED)
def deselect_node(self, selected_node):
node = self.node_list[selected_node]
node.scale(0.8)
node.set_color(self.color)
class Testing3(Scene):
def construct(self):
test = ClockOrganization(numbers=21)
self.play(Write(test), run_time=1.5)
animation_steps=[]
for i in range(10):
thing = test.deepcopy()
thing.select_node((19+i)%test.numbers-1)
animation_steps.append(thing)
self.play(Transform(test, animation_steps[0]))
self.wait(2)
for i in range(1,10):
self.play(Transform(test, animation_steps[i]),run_time=0.3)
self.wait()
If you run it currently, it highlights 19, then revolves to 7 at a uniform pace. Is it possible to set a rate_func
for this overall process, so it starts revolving slowly, speeds up halfway, then slows its way to 7, like the smooth rate_func
but applied over the entire thing?
I have tried changing the above Scene class to
class Testing3(Scene):
def construct(self):
test = ClockOrganization(numbers=21)
self.play(Write(test), run_time=1.5)
animation_steps=[]
for i in range(10):
thing = test.deepcopy()
thing.select_node((19+i)%test.numbers-1)
animation_steps.append(thing)
self.play(Transform(test, animation_steps[0]))
self.wait(2)
for i in range(1,10):
if i in range(1,6):
time_to_run=(sigmoid(10*(-i/4+.75))-sigmoid(-5))/(1-2*sigmoid(-5)+3)+.1
if i in range(6,10):
time_to_run=(sigmoid(10*(i/4-1.75))-sigmoid(-5))/(1-2*sigmoid(-5)+3)+.1
self.play(Transform(test, animation_steps[i]),run_time=time_to_run)
self.wait()
and it comes close to what I'm going for, but the Transforms seem rather choppy.
Or this, start slow, then increase and then slow again