mirror of
https://github.com/3b1b/manim.git
synced 2025-08-21 05:44:04 +00:00
Finishing touches to Winding
This commit is contained in:
parent
25bc1faab2
commit
35270949ab
2 changed files with 106 additions and 14 deletions
|
@ -602,12 +602,15 @@ def walker_animation_with_display(
|
||||||
display = DecimalNumber(0,
|
display = DecimalNumber(0,
|
||||||
num_decimal_points = num_decimal_points,
|
num_decimal_points = num_decimal_points,
|
||||||
fill_color = WHITE,
|
fill_color = WHITE,
|
||||||
include_background_rectangle = True)
|
# include_background_rectangle = True
|
||||||
display.background_rectangle.fill_opacity = 0.5
|
include_background_rectangle = False
|
||||||
display.background_rectangle.fill_color = GREY
|
)
|
||||||
display.background_rectangle.scale(1.2)
|
# display.background_rectangle.fill_opacity = 0.5
|
||||||
|
# display.background_rectangle.fill_color = GREY
|
||||||
|
# display.background_rectangle.scale(1.2)
|
||||||
displaycement = 0.5 * DOWN # How about that pun, eh?
|
displaycement = 0.5 * DOWN # How about that pun, eh?
|
||||||
display.move_to(walker.get_center() + displaycement)
|
# display.move_to(walker.get_center() + displaycement)
|
||||||
|
display.next_to(walker, DOWN+RIGHT, SMALL_BUFF)
|
||||||
display_anim = ChangingDecimal(display,
|
display_anim = ChangingDecimal(display,
|
||||||
number_update_func,
|
number_update_func,
|
||||||
tracked_mobject = walker_anim.compound_walker.walker,
|
tracked_mobject = walker_anim.compound_walker.walker,
|
||||||
|
@ -2044,8 +2047,10 @@ class FundThmAlg(EquationSolver2d):
|
||||||
class SolveX5MinusXMinus1(EquationSolver2d):
|
class SolveX5MinusXMinus1(EquationSolver2d):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"func" : plane_func_from_complex_func(lambda c : c**5 - c - 1),
|
"func" : plane_func_from_complex_func(lambda c : c**5 - c - 1),
|
||||||
"num_iterations" : 5,
|
"num_iterations" : 10,
|
||||||
"use_fancy_lines" : True,
|
"use_fancy_lines" : True,
|
||||||
|
"linger_parameter" : 0.5,
|
||||||
|
"show_cursor" : True,
|
||||||
}
|
}
|
||||||
|
|
||||||
class SolveX5MinusXMinus1Parallel(SolveX5MinusXMinus1):
|
class SolveX5MinusXMinus1Parallel(SolveX5MinusXMinus1):
|
||||||
|
|
|
@ -1928,6 +1928,20 @@ class TinyLoopAroundRed(TinyLoop):
|
||||||
"target_coords" : (-1, 1),
|
"target_coords" : (-1, 1),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ConfusedPiCreature(PiCreatureScene):
|
||||||
|
def construct(self):
|
||||||
|
morty = self.pi_creature
|
||||||
|
morty.set_color(YELLOW_E)
|
||||||
|
morty.flip()
|
||||||
|
morty.center()
|
||||||
|
|
||||||
|
self.play(morty.change, "awe", DOWN+3*RIGHT)
|
||||||
|
self.wait(2)
|
||||||
|
self.play(morty.change, "confused")
|
||||||
|
self.wait(2)
|
||||||
|
self.play(morty.change, "pondering")
|
||||||
|
self.wait(2)
|
||||||
|
|
||||||
class FailureOfComposition(ColorMappedObjectsScene):
|
class FailureOfComposition(ColorMappedObjectsScene):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"func" : lambda p : (
|
"func" : lambda p : (
|
||||||
|
@ -2354,7 +2368,6 @@ class TransitionFromPathsToBoundaries(ColorMappedObjectsScene):
|
||||||
self.start_rev = self.get_output_rev()
|
self.start_rev = self.get_output_rev()
|
||||||
self.curr_winding = 0
|
self.curr_winding = 0
|
||||||
|
|
||||||
|
|
||||||
class TransitionFromPathsToBoundariesArrowless(TransitionFromPathsToBoundaries):
|
class TransitionFromPathsToBoundariesArrowless(TransitionFromPathsToBoundaries):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"func" : plane_func_by_wind_spec(
|
"func" : plane_func_by_wind_spec(
|
||||||
|
@ -2644,9 +2657,7 @@ class PolynomialTerms(MonomialTerm):
|
||||||
|
|
||||||
class SearchSpacePerimeterVsArea(EquationSolver2d):
|
class SearchSpacePerimeterVsArea(EquationSolver2d):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"func" : plane_func_by_wind_spec(
|
"func" : example_plane_func,
|
||||||
(-3, -1.3, 2), (0.1, 0.2, 1), (2.8, -2, 1)
|
|
||||||
),
|
|
||||||
"num_iterations" : 15,
|
"num_iterations" : 15,
|
||||||
"display_in_parallel" : False,
|
"display_in_parallel" : False,
|
||||||
"use_fancy_lines" : True,
|
"use_fancy_lines" : True,
|
||||||
|
@ -2709,6 +2720,15 @@ class SearchSpacePerimeterVsArea(EquationSolver2d):
|
||||||
self.play(FadeOut(full_rect))
|
self.play(FadeOut(full_rect))
|
||||||
self.wait()
|
self.wait()
|
||||||
|
|
||||||
|
class ShowPolynomialFinalState(SolveX5MinusXMinus1):
|
||||||
|
CONFIG = {
|
||||||
|
"num_iterations" : 15,
|
||||||
|
}
|
||||||
|
def construct(self):
|
||||||
|
self.force_skipping()
|
||||||
|
SolveX5MinusXMinus1.construct(self)
|
||||||
|
self.revert_to_original_skipping_status()
|
||||||
|
|
||||||
class PiCreatureInAwe(Scene):
|
class PiCreatureInAwe(Scene):
|
||||||
def construct(self):
|
def construct(self):
|
||||||
randy = Randolph()
|
randy = Randolph()
|
||||||
|
@ -2729,8 +2749,9 @@ class ShowComplexFunction(Scene):
|
||||||
def construct(self):
|
def construct(self):
|
||||||
plane = ComplexPlane()
|
plane = ComplexPlane()
|
||||||
plane.add_coordinates()
|
plane.add_coordinates()
|
||||||
plane.remove(plane.coordinate_labels[-1])
|
four_i = plane.coordinate_labels[-1]
|
||||||
plane.show()
|
plane.coordinate_labels.remove(four_i)
|
||||||
|
plane.remove(four_i)
|
||||||
|
|
||||||
title = TextMobject("Complex Plane")
|
title = TextMobject("Complex Plane")
|
||||||
title.to_edge(UP, buff = MED_SMALL_BUFF)
|
title.to_edge(UP, buff = MED_SMALL_BUFF)
|
||||||
|
@ -2851,6 +2872,47 @@ class WindingNumbersInInputOutputContext(PathContainingZero):
|
||||||
rate_func = bezier([0, 0, 1, 1])
|
rate_func = bezier([0, 0, 1, 1])
|
||||||
)
|
)
|
||||||
|
|
||||||
|
class SolveX5SkipToEnd(SolveX5MinusXMinus1):
|
||||||
|
CONFIG = {
|
||||||
|
"num_iterations" : 4,
|
||||||
|
}
|
||||||
|
def construct(self):
|
||||||
|
self.force_skipping()
|
||||||
|
SolveX5MinusXMinus1.construct(self)
|
||||||
|
self.revert_to_original_skipping_status()
|
||||||
|
|
||||||
|
mobjects = VGroup(*self.get_mobjects())
|
||||||
|
lines = VGroup()
|
||||||
|
rects = VGroup()
|
||||||
|
for mob in mobjects:
|
||||||
|
if mob.background_image_file is not None:
|
||||||
|
mob.set_stroke(width = 2)
|
||||||
|
lines.add(mob)
|
||||||
|
elif isinstance(mob, Polygon):
|
||||||
|
rects.add(mob)
|
||||||
|
else:
|
||||||
|
self.remove(mob)
|
||||||
|
|
||||||
|
self.clear()
|
||||||
|
self.add(lines, rects)
|
||||||
|
|
||||||
|
class ZeroFoundOnBoundary(Scene):
|
||||||
|
def construct(self):
|
||||||
|
arrow = Vector(DOWN+LEFT, color = WHITE)
|
||||||
|
words = TextMobject("Found zero on boundary!")
|
||||||
|
words.next_to(arrow.get_start(), UP)
|
||||||
|
words.shift(1.5*RIGHT)
|
||||||
|
|
||||||
|
point = VectorizedPoint()
|
||||||
|
point.next_to(arrow, DOWN+LEFT)
|
||||||
|
|
||||||
|
self.play(Flash(point))
|
||||||
|
self.play(
|
||||||
|
GrowArrow(arrow),
|
||||||
|
Write(words),
|
||||||
|
)
|
||||||
|
self.wait()
|
||||||
|
|
||||||
class AllOfTheVideos(Scene):
|
class AllOfTheVideos(Scene):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"camera_config" : {
|
"camera_config" : {
|
||||||
|
@ -3188,8 +3250,33 @@ class EndScreen(PatreonEndScreen, PiCreatureScene):
|
||||||
self.play(morty.change, mode)
|
self.play(morty.change, mode)
|
||||||
self.wait(2)
|
self.wait(2)
|
||||||
|
|
||||||
|
class Thumbnail(SearchSpacePerimeterVsArea):
|
||||||
|
CONFIG = {
|
||||||
|
"num_iterations" : 18,
|
||||||
|
"func" : plane_func_by_wind_spec(
|
||||||
|
(-3, -1.3, 2), (0.1, 0.2, 1), (2.8, -2, 1)
|
||||||
|
),
|
||||||
|
}
|
||||||
|
def construct(self):
|
||||||
|
self.force_skipping()
|
||||||
|
EquationSolver2d.construct(self)
|
||||||
|
self.revert_to_original_skipping_status()
|
||||||
|
|
||||||
|
mobjects = VGroup(*self.get_mobjects())
|
||||||
|
lines = VGroup()
|
||||||
|
rects = VGroup()
|
||||||
|
get_length = lambda mob : max(mob.get_width(), mob.get_height())
|
||||||
|
for mob in mobjects:
|
||||||
|
if mob.background_image_file is not None:
|
||||||
|
mob.set_stroke(width = 4*np.sqrt(get_length(mob)))
|
||||||
|
lines.add(mob)
|
||||||
|
elif isinstance(mob, Polygon):
|
||||||
|
rects.add(mob)
|
||||||
|
else:
|
||||||
|
self.remove(mob)
|
||||||
|
|
||||||
|
self.clear()
|
||||||
|
self.add(lines)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue