def show_diameter(self): exceptions = [ self.circle, self.tangent_line, self.pc_line, self.right_angle_symbol ] everything = set(self.mobjects).difference(exceptions) everything_copy = Mobject(*everything).copy() light_everything = everything_copy.copy() dark_everything = everything_copy.copy() dark_everything.fade(0.8) bottom_point = np.array(self.c_point) bottom_point += 2 * self.radius * DOWN diameter = Line(bottom_point, self.c_point) brace = Brace(diameter, RIGHT) diameter_word = TextMobject("Diameter") d_mob = TexMobject("D") diameter_word.next_to(brace) d_mob.next_to(diameter) self.remove(*everything) self.play(Transform(everything_copy, dark_everything)) self.dither() self.play(ShowCreation(diameter)) self.play(GrowFromCenter(brace)) self.play(ShimmerIn(diameter_word)) self.dither() self.play(*[Transform(mob, d_mob) for mob in brace, diameter_word]) self.remove(brace, diameter_word) self.add(d_mob) self.play(Transform(everything_copy, light_everything)) self.remove(everything_copy) self.add(*everything) self.d_mob = d_mob self.bottom_point = bottom_point
def show_diameter(self): exceptions = [ self.circle, self.tangent_line, self.pc_line, self.right_angle_symbol ] everything = set(self.mobjects).difference(exceptions) everything_copy = Mobject(*everything).copy() light_everything = everything_copy.copy() dark_everything = everything_copy.copy() dark_everything.fade(0.8) bottom_point = np.array(self.c_point) bottom_point += 2*self.radius*DOWN diameter = Line(bottom_point, self.c_point) brace = Brace(diameter, RIGHT) diameter_word = TextMobject("Diameter") d_mob = TexMobject("D") diameter_word.next_to(brace) d_mob.next_to(diameter) self.remove(*everything) self.play(Transform(everything_copy, dark_everything)) self.dither() self.play(ShowCreation(diameter)) self.play(GrowFromCenter(brace)) self.play(ShimmerIn(diameter_word)) self.dither() self.play(*[ Transform(mob, d_mob) for mob in brace, diameter_word ]) self.remove(brace, diameter_word) self.add(d_mob) self.play(Transform(everything_copy, light_everything)) self.remove(everything_copy) self.add(*everything) self.d_mob = d_mob self.bottom_point = bottom_point
def construct(self): text = TextMobject([ "PHC", "_n", "(", "x", ")$", " has a limit point ", "as $n \\to \\infty$", "\\\\ for all $x$" ]) parts = text.split() parts[-1].next_to(Mobject(*parts[:-1]), DOWN) parts[-1].highlight(BLUE) parts[3].highlight(BLUE) parts[1].highlight() parts[-2].highlight() text.to_edge(UP) curve = UnitInterval() curve.sort_points(lambda p : p[0]) vals = np.arange(0.1, 1, 0.1) dots = Mobject(*[ Dot(curve.number_to_point(val)) for val in vals ]) curve.add_numbers(0, 1) starter_dots = dots.copy().ingest_submobjects() starter_dots.shift(2*UP) self.add(curve, text) self.wait() self.play(DelayByOrder(ApplyMethod(starter_dots.shift, 2*DOWN))) self.wait() self.remove(starter_dots) self.add(dots) for num in range(1, 10): new_curve = HilbertCurve(order = num) new_curve.scale(0.8) new_dots = Mobject(*[ Dot(new_curve.points[int(val*new_curve.get_num_points())]) for val in vals ]) self.play( Transform(curve, new_curve), Transform(dots, new_dots), )
def construct(self): text = TextMobject([ "PHC", "_n", "(", "x", ")$", " has a limit point ", "as $n \\to \\infty$", "\\\\ for all $x$" ]) parts = text.split() parts[-1].next_to(Mobject(*parts[:-1]), DOWN) parts[-1].highlight(BLUE) parts[3].highlight(BLUE) parts[1].highlight() parts[-2].highlight() text.to_edge(UP) curve = UnitInterval() curve.sort_points(lambda p : p[0]) vals = np.arange(0.1, 1, 0.1) dots = Mobject(*[ Dot(curve.number_to_point(val)) for val in vals ]) curve.add_numbers(0, 1) starter_dots = dots.copy().ingest_sub_mobjects() starter_dots.shift(2*UP) self.add(curve, text) self.dither() self.play(DelayByOrder(ApplyMethod(starter_dots.shift, 2*DOWN))) self.dither() self.remove(starter_dots) self.add(dots) for num in range(1, 10): new_curve = HilbertCurve(order = num) new_curve.scale(0.8) new_dots = Mobject(*[ Dot(new_curve.points[int(val*new_curve.get_num_points())]) for val in vals ]) self.play( Transform(curve, new_curve), Transform(dots, new_dots), )
def construct(self): n_terms = 4 def func((x, y, ignore)): z = complex(x, y) if (np.abs(x%1 - 0.5)<0.01 and y < 0.01) or np.abs(z)<0.01: return ORIGIN out_z = 1./(2*np.tan(np.pi*z)*(z**2)) return out_z.real*RIGHT - out_z.imag*UP arrows = Mobject(*[ Arrow(ORIGIN, np.sqrt(2)*point) for point in compass_directions(4, RIGHT+UP) ]) arrows.highlight(YELLOW) arrows.ingest_submobjects() all_arrows = Mobject(*[ arrows.copy().scale(0.3/(x)).shift(x*RIGHT) for x in range(1, n_terms+2) ]) terms = TexMobject([ "\\dfrac{1}{%d^2} + "%(x+1) for x in range(n_terms) ]+["\\cdots"]) terms.shift(2*UP) plane = NumberPlane(color = BLUE_E) axes = Mobject(NumberLine(), NumberLine().rotate(np.pi/2)) axes.highlight(WHITE) for term in terms.split(): self.play(ShimmerIn(term, run_time = 0.5)) self.dither() self.play(ShowCreation(plane), ShowCreation(axes)) self.play(*[ Transform(*pair) for pair in zip(terms.split(), all_arrows.split()) ]) self.play(PhaseFlow( func, plane, run_time = 5, virtual_time = 8 ))