Sine-curve by rotating dot around the circle
Code from manimlib.imports import * class Sine_Curve(Scene): def construct(self): self.show_axis() self.show_circle() self.move_dot_and_draw_curve() self.wait() def show_axis(self): x_start = np.array([-6,0,0]) x_end = np.array([6,0,0]) y_start = np.array([-4,-2,0]) y_end = np.array([-4,2,0]) x_axis = Line(x_start, x_end) y_axis = Line(y_start, y_end) self.add(x_axis, y_axis) self.add_x_labels()..
[47] add_updater
def moving_dot(self): x_axis = NumberLine(x_min=-5, x_max=5) dot = Dot(color=RED, radius=0.15).move_to(x_axis.get_left()) number = DecimalNumber(-5, color=RED).next_to(dot, UP) number.add_updater(lambda m: m.next_to(dot, UP)) number.add_updater(lambda m: m.set_value(dot.get_center()[0])) self.add(x_axis, dot, number) self.play(dot.shift, RIGHT * 10, rate_func=there_and_back, run_time=10) self.wa..
[45]Special Effects
def broadcast(self): text = VGroup( TextMobject("Monday"), TextMobject("Tuesday"), TextMobject("Wednesday"), TextMobject("Thursday"), TextMobject("Friday"), ).arrange(DOWN) dot = Dot(color=RED).move_to(2 * RIGHT) self.add(dot) def get_broadcast(): return Broadcast(dot, big_radius=5, color=RED, run_time=5) self.play( LaggedStartMap(FadeIn, text, run_time=4, lag_ratio=0.7), Succession(*[ get_broad..