ContinualUpdateFromFunc -> ContinualUpdate

This commit is contained in:
Grant Sanderson 2018-08-13 13:40:52 -07:00
parent bafe6150dd
commit 109fe5c4ea
14 changed files with 105 additions and 102 deletions

2
.gitignore vendored
View file

@ -3,6 +3,8 @@
.DS_Store
homeless.py
playground.py
cairo_test.py
mayavi_test.py
random_scenes/
files/
ben_playground.py

View file

@ -21,6 +21,7 @@ class ChangingDecimal(Animation):
dmc = decimal_number_mobject.get_center()
tmc = self.tracked_mobject.get_center()
self.diff_from_tracked_mobject = dmc - tmc
self.diff_from_tracked_mobject = dmc - tmc
Animation.__init__(self, decimal_number_mobject, **kwargs)
def update_mobject(self, alpha):

View file

@ -5,7 +5,7 @@ from animation.update import MaintainPositionRelativeTo
from mobject.value_tracker import ValueTracker
class ContinualUpdateFromFunc(ContinualAnimation):
class ContinualUpdate(ContinualAnimation):
CONFIG = {
"function_depends_on_dt": False
}
@ -21,7 +21,7 @@ class ContinualUpdateFromFunc(ContinualAnimation):
self.func(self.mobject)
class ContinualUpdateFromTimeFunc(ContinualUpdateFromFunc):
class ContinualUpdateFromTimeFunc(ContinualUpdate):
CONFIG = {
"function_depends_on_dt": True
}

View file

@ -964,7 +964,7 @@ class IntroduceInputOutputScene(InputOutputScene):
return dots
def get_output_dot_continual_update(self, input_dot, output_dot):
return ContinualUpdateFromFunc(
return ContinualUpdate(
output_dot,
lambda od : od.move_to(self.point_function(input_dot.get_center()))
)
@ -992,7 +992,7 @@ class IntroduceVectorField(IntroduceInputOutputScene):
color = out_dot.get_color(),
)
out_vector.set_stroke(BLACK, 1)
continual_out_vector_update = ContinualUpdateFromFunc(
continual_out_vector_update = ContinualUpdate(
out_vector, lambda ov : ov.put_start_and_end_on(
output_plane.coords_to_point(0, 0),
out_dot.get_center(),
@ -1004,7 +1004,7 @@ class IntroduceVectorField(IntroduceInputOutputScene):
Transform(in_vector, out_vector).update(1)
in_vector.scale(0.5)
in_vector.shift(in_dot.get_center() - in_vector.get_start())
continual_in_vector_update = ContinualUpdateFromFunc(
continual_in_vector_update = ContinualUpdate(
in_vector, update_in_vector
)
continual_updates = [
@ -2305,7 +2305,7 @@ class TransitionFromPathsToBoundaries(ColorMappedObjectsScene):
#Setup dot, arrow and label
dot = self.dot = Dot(radius = 0.1)
dot.set_stroke(WHITE, self.dot_stroke_width)
update_dot_color = ContinualUpdateFromFunc(
update_dot_color = ContinualUpdate(
dot, lambda d : d.set_fill(
get_output_color(),
self.dot_fill_opacity
@ -2327,7 +2327,7 @@ class TransitionFromPathsToBoundaries(ColorMappedObjectsScene):
arrow.scale(arrow_length/arrow.get_length())
arrow.shift(dot.get_center() - arrow.get_start())
return arrow
update_arrow = ContinualUpdateFromFunc(arrow, arrow_update_func)
update_arrow = ContinualUpdate(arrow, arrow_update_func)
if self.include_walkers:
self.add(update_arrow, update_dot_color, label_upadte)
@ -2796,27 +2796,27 @@ class WindingNumbersInInputOutputContext(PathContainingZero):
out_loop = in_loop.copy()
out_loop.match_background_image_file(self.output_coloring)
update_out_loop = ContinualUpdateFromFunc(
update_out_loop = ContinualUpdate(
out_loop,
lambda m : m.set_points(in_loop.points).apply_function(self.point_function)
)
# self.add(update_out_loop)
in_dot = Dot(radius = 0.04)
update_in_dot = ContinualUpdateFromFunc(
update_in_dot = ContinualUpdate(
in_dot, lambda d : d.move_to(in_loop.point_from_proportion(1))
)
self.add(update_in_dot)
out_arrow = Arrow(LEFT, RIGHT)
update_out_arrow = ContinualUpdateFromFunc(
update_out_arrow = ContinualUpdate(
out_arrow,
lambda a : a.put_start_and_end_on(
self.output_plane.coords_to_point(0, 0),
out_loop.point_from_proportion(1)
)
)
update_out_arrow_color = ContinualUpdateFromFunc(
update_out_arrow_color = ContinualUpdate(
out_arrow,
lambda a : a.set_color(rev_to_color(a.get_angle()/TAU))
)
@ -2974,7 +2974,7 @@ class TickingClock(Scene):
line.set_color(rev_to_color(rev))
for line in lines:
self.add(ContinualUpdateFromFunc(line, update_line))
self.add(ContinualUpdate(line, update_line))
run_time = self.run_time
self.play(ClockPassesTime(
@ -3199,7 +3199,7 @@ class PatreonScroll(Scene):
patrons.remove(patron)
alpha = smooth(np.clip(2.5 - y, 0, 1))
patron.set_fill(opacity = alpha)
opacity_update = ContinualUpdateFromFunc(patrons, patrons_opacity_update)
opacity_update = ContinualUpdate(patrons, patrons_opacity_update)
self.add(scroll, opacity_update)
self.wait(55)

View file

@ -707,14 +707,14 @@ class StartingCalc101(PiCreatureScene):
tracker.get_value() + dt
)
),
ContinualUpdateFromFunc(
ContinualUpdate(
spring,
lambda s: s.stretch_to_fit_height(
1.5 + 0.5 * np.cos(3 * t_tracker.get_value()),
about_edge=UP
)
),
ContinualUpdateFromFunc(
ContinualUpdate(
weight,
lambda w: w.move_to(spring.points[-1])
)
@ -934,7 +934,7 @@ class ChangingVectorField(Scene):
self.add(ContinualGrowValue(time_tracker))
vectors = self.get_vectors()
self.add(ContinualUpdateFromFunc(
self.add(ContinualUpdate(
vectors,
lambda vs: self.update_vectors(vs)
))
@ -1111,36 +1111,36 @@ class StandardDerivativeVisual(GraphScene):
triangle.set_stroke(width=0)
triangle.scale(0.1)
input_triangle_update = ContinualUpdateFromFunc(
input_triangle_update = ContinualUpdate(
input_triangle, lambda m: m.move_to(get_x_point(), UP)
)
output_triangle_update = ContinualUpdateFromFunc(
output_triangle_update = ContinualUpdate(
output_triangle, lambda m: m.move_to(get_y_point(), RIGHT)
)
x_label = TexMobject("x")
x_label_update = ContinualUpdateFromFunc(
x_label_update = ContinualUpdate(
x_label, lambda m: m.next_to(input_triangle, DOWN, SMALL_BUFF)
)
output_label = TexMobject("f(x)")
output_label_update = ContinualUpdateFromFunc(
output_label_update = ContinualUpdate(
output_label, lambda m: m.next_to(
output_triangle, LEFT, SMALL_BUFF)
)
v_line = get_v_line()
v_line_update = ContinualUpdateFromFunc(
v_line_update = ContinualUpdate(
v_line, lambda vl: Transform(vl, get_v_line()).update(1)
)
h_line = get_h_line()
h_line_update = ContinualUpdateFromFunc(
h_line_update = ContinualUpdate(
h_line, lambda hl: Transform(hl, get_h_line()).update(1)
)
graph_dot = Dot(color=YELLOW)
graph_dot_update = ContinualUpdateFromFunc(
graph_dot_update = ContinualUpdate(
graph_dot, lambda m: m.move_to(get_graph_point())
)
@ -1192,7 +1192,7 @@ class StandardDerivativeVisual(GraphScene):
).secant_line
slope_line = get_slope_line()
slope_line_update = ContinualUpdateFromFunc(
slope_line_update = ContinualUpdate(
slope_line, lambda sg: Transform(sg, get_slope_line()).update(1)
)
@ -1203,7 +1203,7 @@ class StandardDerivativeVisual(GraphScene):
"\\frac{df}{dx}(x) =", "\\text{Slope}", "="
)
deriv_label.get_part_by_tex("Slope").match_color(slope_line)
deriv_label_update = ContinualUpdateFromFunc(
deriv_label_update = ContinualUpdate(
deriv_label, position_deriv_label
)

View file

@ -1322,13 +1322,13 @@ class IntroduceScreen(Scene):
def rotate_screen(self):
self.add(
ContinualUpdateFromFunc(
ContinualUpdate(
self.light_source,
lambda m : m.update()
),
)
self.add(
ContinualUpdateFromFunc(
ContinualUpdate(
self.angle_indicator,
lambda m : m.set_stroke(width = 0).set_fill(opacity = 1)
)
@ -1631,8 +1631,8 @@ class InverseSquareLaw(ThreeDScene):
def update_spotlight(spotlight):
spotlight.update_sectors()
spotlight_update = ContinualUpdateFromFunc(spotlight, update_spotlight)
shadow_update = ContinualUpdateFromFunc(
spotlight_update = ContinualUpdate(spotlight, update_spotlight)
shadow_update = ContinualUpdate(
shadow, lambda m : light_source.update_shadow()
)
@ -1644,7 +1644,7 @@ class InverseSquareLaw(ThreeDScene):
distance = np.linalg.norm(screen.get_reference_point() - source_point)
light_indicator.set_intensity(1.0/(distance/unit_distance)**2)
light_indicator.next_to(morty, UP, MED_LARGE_BUFF)
light_indicator_update = ContinualUpdateFromFunc(
light_indicator_update = ContinualUpdate(
light_indicator, update_light_indicator
)
light_indicator_update.update(0)
@ -1966,7 +1966,7 @@ class ManipulateLightsourceSetups(PiCreatureScene):
self.add(light_source)
self.add_foreground_mobjects(morty, bubble, light_indicator)
self.add(ContinualUpdateFromFunc(light_indicator, update_light_indicator))
self.add(ContinualUpdate(light_indicator, update_light_indicator))
self.play(
ApplyMethod(
light_source.shift, 0.66*unit_distance*LEFT,
@ -2167,7 +2167,7 @@ class TwoLightSourcesScene(ManipulateLightsourceSetups):
d_indensity *= ls.ambient_light.submobjects[1].get_fill_opacity()
intensity += d_indensity
indicator.set_intensity(intensity)
indicator_update_anim = ContinualUpdateFromFunc(indicator, update_indicator)
indicator_update_anim = ContinualUpdate(indicator, update_indicator)
new_indicator = indicator.copy()
new_indicator.light_source = lsC
@ -2613,7 +2613,7 @@ class IPTScene(TwoLightSourcesScene, ZoomedScene):
)
spotlights = VGroup(spotlight_a, spotlight_b)
spotlights_update_anim = ContinualUpdateFromFunc(
spotlights_update_anim = ContinualUpdate(
spotlights, update_spotlights
)
@ -2761,7 +2761,7 @@ class DiameterTheorem(TeacherStudentsScene):
circle.get_left(), circle.get_right(),
point.get_center(), circle.get_left(),
])
triangle_update_anim = ContinualUpdateFromFunc(
triangle_update_anim = ContinualUpdate(
triangle, update_triangle
)
triangle_update_anim.update(0)
@ -2826,7 +2826,7 @@ class InscribedeAngleThreorem(TeacherStudentsScene):
circle.point_from_proportion(1./8),
point.get_center(),
])
shape_update_anim = ContinualUpdateFromFunc(
shape_update_anim = ContinualUpdate(
shape, update_shape
)
shape_update_anim.update(0)
@ -3854,7 +3854,7 @@ class ThinkBackToHowAmazingThisIs(ThreeDScene):
z = self.camera.rotation_mobject.get_center()[2]
decimal.set_height(0.07*z)
decimal.move_to(0.7*z*UP)
scale_decimal = ContinualUpdateFromFunc(decimal, update_decimal)
scale_decimal = ContinualUpdate(decimal, update_decimal)
self.add(number_line, *dot_pairs)

View file

@ -546,7 +546,7 @@ class EccentricityInThumbtackCase(ShowArrayOfEccentricities):
focus_distance.set_color(GREEN)
focus_distance.next_to(inner_brace_update.mobject, DOWN, SMALL_BUFF)
focus_distance.add_to_back(focus_distance.copy().set_stroke(BLACK, 5))
focus_distance_update = ContinualUpdateFromFunc(
focus_distance_update = ContinualUpdate(
focus_distance,
lambda m: m.set_width(
inner_brace_update.mobject.get_width(),
@ -565,7 +565,7 @@ class EccentricityInThumbtackCase(ShowArrayOfEccentricities):
fraction.set_color_by_tex("Diameter", RED)
fraction.move_to(2 * UP)
fraction.to_edge(RIGHT, buff=MED_LARGE_BUFF)
numerator_update = ContinualUpdateFromFunc(
numerator_update = ContinualUpdate(
numerator,
lambda m: m.set_width(focus_distance.get_width()).next_to(
fraction[1], UP, MED_SMALL_BUFF
@ -631,7 +631,7 @@ class EccentricityInThumbtackCase(ShowArrayOfEccentricities):
thumbtack.move_to(focus, DR)
return thumbtacks
return ContinualUpdateFromFunc(thumbtacks, update_thumbtacks)
return ContinualUpdate(thumbtacks, update_thumbtacks)
def get_ellipse_point_update(self, ellipse):
dot = Dot(color=RED)
@ -652,10 +652,10 @@ class EccentricityInThumbtackCase(ShowArrayOfEccentricities):
line.put_start_and_end_on(focus, Q)
return lines
return ContinualUpdateFromFunc(lines, update_lines)
return ContinualUpdate(lines, update_lines)
def get_focus_to_focus_line_update(self, ellipse):
return ContinualUpdateFromFunc(
return ContinualUpdate(
Line(LEFT, RIGHT, color=WHITE),
lambda m: m.put_start_and_end_on(*self.get_foci(ellipse))
)
@ -663,7 +663,7 @@ class EccentricityInThumbtackCase(ShowArrayOfEccentricities):
def get_focus_line_to_focus_line_brace_update(self, line):
brace = Brace(Line(LEFT, RIGHT))
brace.add_to_back(brace.copy().set_stroke(BLACK, 5))
return ContinualUpdateFromFunc(
return ContinualUpdate(
brace,
lambda b: b.match_width(line, stretch=True).next_to(
line, DOWN, buff=SMALL_BUFF
@ -1614,7 +1614,7 @@ class EllipseLengthsLinedUp(EccentricityInThumbtackCase):
lines.arrange_submobjects(DOWN, buff=0)
lines.next_to(arrow, RIGHT)
h_line.move_to(lines[0].get_bottom())
lines_animation = ContinualUpdateFromFunc(
lines_animation = ContinualUpdate(
lines, update_lines
)

View file

@ -1587,7 +1587,7 @@ class ChangingElectricField(Scene):
particle.shift(particle.velocity * dt)
self.add(
ContinualUpdateFromFunc(vector_field, update_vector_field),
ContinualUpdate(vector_field, update_vector_field),
ContinualUpdateFromTimeFunc(particles, update_particles),
)
self.wait(20)
@ -1822,7 +1822,7 @@ class DefineDivergence(ChangingElectricField):
"\\text{div} \\, \\textbf{F}(x, y) = "
)
div_tex.add_background_rectangle()
div_tex_update = ContinualUpdateFromFunc(
div_tex_update = ContinualUpdate(
div_tex, lambda m: m.next_to(circle, UP, SMALL_BUFF)
)
@ -2066,7 +2066,7 @@ class DivergenceAsNewFunction(Scene):
)
self.add(func_tex, rhs)
# self.add(ContinualUpdateFromFunc(
# self.add(ContinualUpdate(
# rhs, lambda m: m.next_to(func_tex, RIGHT)
# ))
@ -2090,7 +2090,7 @@ class DivergenceAsNewFunction(Scene):
out_vect.move_to(rhs)
out_vect.set_fill(opacity=0)
self.play(out_vect.restore)
self.out_vect_update = ContinualUpdateFromFunc(
self.out_vect_update = ContinualUpdate(
out_vect,
lambda ov: Transform(ov, get_out_vect()).update(1)
)
@ -2098,7 +2098,7 @@ class DivergenceAsNewFunction(Scene):
self.add(self.out_vect_update)
self.add(out_x_update, out_y_update)
self.add(ContinualUpdateFromFunc(
self.add(ContinualUpdate(
VGroup(out_x, out_y),
lambda m: m.match_style(out_vect)
))
@ -2167,7 +2167,7 @@ class DivergenceAsNewFunction(Scene):
))
vector_ring = get_vector_ring()
vector_ring_update = ContinualUpdateFromFunc(
vector_ring_update = ContinualUpdate(
vector_ring,
lambda vr: Transform(vr, get_vector_ring()).update(1)
)
@ -2195,7 +2195,7 @@ class DivergenceAsNewFunction(Scene):
)
# This line is a dumb hack around a Scene bug
self.add(*[
ContinualUpdateFromFunc(
ContinualUpdate(
mob, lambda m: m.set_fill(None, 0)
)
for mob in (out_x, out_y)
@ -2566,7 +2566,7 @@ class ShowCurlAtVariousPoints(IntroduceCurl):
dot = Dot()
circle = Circle(radius=0.25, color=WHITE)
circle.move_to(dot)
circle_update = ContinualUpdateFromFunc(
circle_update = ContinualUpdate(
circle,
lambda m: m.move_to(dot)
)
@ -2575,7 +2575,7 @@ class ShowCurlAtVariousPoints(IntroduceCurl):
"\\text{curl} \\, \\textbf{F}(x, y) = "
)
curl_tex.add_background_rectangle(buff=0.025)
curl_tex_update = ContinualUpdateFromFunc(
curl_tex_update = ContinualUpdate(
curl_tex,
lambda m: m.next_to(circle, UP, SMALL_BUFF)
)
@ -3083,10 +3083,10 @@ class ShowTwoPopulations(Scene):
return update
self.add(ContinualUpdateFromFunc(
self.add(ContinualUpdate(
foxes, get_updater(get_num_foxes)
))
self.add(ContinualUpdateFromFunc(
self.add(ContinualUpdate(
rabbits, get_updater(get_num_rabbits)
))
@ -3105,7 +3105,7 @@ class ShowTwoPopulations(Scene):
))
for count in num_foxes, num_rabbits:
self.add(ContinualUpdateFromFunc(
self.add(ContinualUpdate(
count, self.update_count_color,
))
@ -3254,7 +3254,7 @@ class PhaseSpaceOfPopulationModel(ShowTwoPopulations, PiCreatureScene, MovingCam
position_update_func=lambda m: m.move_to(tens[i])
)
coord_pair.add_background_rectangle()
coord_pair_update = ContinualUpdateFromFunc(
coord_pair_update = ContinualUpdate(
coord_pair, lambda m: m.next_to(dot, UR, SMALL_BUFF)
)
pop_sizes_updates = [get_pop_size_update(i) for i in (0, 1)]
@ -3815,7 +3815,7 @@ class ShowCrossProduct(ShowDotProduct):
fill_opacity=0.2,
)
self.add(ContinualUpdateFromFunc(
self.add(ContinualUpdate(
square,
lambda s: s.set_points_as_corners([
ORIGIN,
@ -4025,7 +4025,7 @@ class DivergenceTinyNudgesView(MovingCameraScene):
moving_step_vector.get_end(),
moving_step_vector.get_end() + diff,
)
self.moving_diff_vector_update = ContinualUpdateFromFunc(
self.moving_diff_vector_update = ContinualUpdate(
moving_diff_vector,
update_moving_diff_vector
)

View file

@ -2660,7 +2660,7 @@ class WriteComplexExponentialExpression(DrawFrequencyPlot):
v_line.put_start_and_end_on(
plane.coords_to_point(x, 0), point
)
lines_update_anim = ContinualUpdateFromFunc(lines, lines_update)
lines_update_anim = ContinualUpdate(lines, lines_update)
lines_update_anim.update(0)
self.add(lines_update_anim)
@ -2758,12 +2758,12 @@ class WriteComplexExponentialExpression(DrawFrequencyPlot):
exp_base.get_corner(UP+RIGHT), DOWN+LEFT
)
)
exp_base_update = ContinualUpdateFromFunc(
exp_base_update = ContinualUpdate(
exp_base, lambda e : e.move_to(get_circle_point(
scalar = 1.1, t_shift = 0.01*TAU
))
)
vector_update = ContinualUpdateFromFunc(
vector_update = ContinualUpdate(
vector, lambda v : v.put_start_and_end_on(
plane.number_to_point(0), get_circle_point()
)
@ -4004,7 +4004,7 @@ class ShowUncertaintyPrinciple(Scene):
))
self.wait(2)
self.add(*[
ContinualUpdateFromFunc(graph, get_update_func(axes))
ContinualUpdate(graph, get_update_func(axes))
for graph, axes in [(top_graph, top_axes), (bottom_graph, bottom_axes)]
])
for factor in factors:

View file

@ -750,7 +750,7 @@ class AskAboutEllipses(TheMotionOfPlanets):
l2.put_start_and_end_on(f2, P)
return lines
animation = ContinualUpdateFromFunc(
animation = ContinualUpdate(
lines, update_lines
)
self.add(animation)
@ -785,7 +785,7 @@ class AskAboutEllipses(TheMotionOfPlanets):
)
Transform(measurement, new_decimal).update(1)
radius_measurement_animation = ContinualUpdateFromFunc(
radius_measurement_animation = ContinualUpdate(
radius_measurement, update_radial_measurement
)
@ -943,7 +943,7 @@ class AskAboutEllipses(TheMotionOfPlanets):
arrow.shift(
radial_line.get_end() - arrow.get_start()
)
force_arrow_animation = ContinualUpdateFromFunc(
force_arrow_animation = ContinualUpdate(
force_arrow, update_force_arrow
)
@ -952,7 +952,7 @@ class AskAboutEllipses(TheMotionOfPlanets):
def get_radial_line_and_update(self, comet):
line = Line(LEFT, RIGHT)
line.set_stroke(LIGHT_GREY, 1)
line_update = ContinualUpdateFromFunc(
line_update = ContinualUpdate(
line, lambda l: l.put_start_and_end_on(
self.sun.get_center(),
comet.get_center(),
@ -1207,7 +1207,7 @@ class ShowEllipseDefiningProperty(Scene):
dot = Dot()
dot.scale(0.5)
position_tracker = ValueTracker(0.125)
dot_update = ContinualUpdateFromFunc(
dot_update = ContinualUpdate(
dot,
lambda d: d.move_to(
self.ellipse.point_from_proportion(
@ -1378,7 +1378,7 @@ class ShowEllipseDefiningProperty(Scene):
focus, focal_sum_point.get_center()
)
lines[1].rotate(np.pi)
lines_update_animation = ContinualUpdateFromFunc(
lines_update_animation = ContinualUpdate(
lines, update_lines
)
return lines, lines_update_animation
@ -1413,7 +1413,7 @@ class ShowEllipseDefiningProperty(Scene):
)
label.submobjects = list(new_decimal.submobjects)
distance_labels_animation = ContinualUpdateFromFunc(
distance_labels_animation = ContinualUpdate(
distance_labels, update_distance_labels
)
@ -1791,7 +1791,7 @@ class ProveEllipse(ShowEmergingEllipse, ShowEllipseDefiningProperty):
if line.get_end()[0] > line.get_start()[0]:
vect = label.get_center() - line.get_center()
label.shift(-2 * vect)
distance_label_shift_update_animation = ContinualUpdateFromFunc(
distance_label_shift_update_animation = ContinualUpdate(
self.distance_labels[0],
distance_label_shift_update
)
@ -1802,7 +1802,7 @@ class ProveEllipse(ShowEmergingEllipse, ShowEllipseDefiningProperty):
# Define QP line
QP_line = Line(LEFT, RIGHT)
QP_line.match_style(self.focal_lines)
QP_line_update = ContinualUpdateFromFunc(
QP_line_update = ContinualUpdate(
QP_line, lambda l: l.put_start_and_end_on(
Q_dot.get_center(), P_dot.get_center(),
)
@ -1810,7 +1810,7 @@ class ProveEllipse(ShowEmergingEllipse, ShowEllipseDefiningProperty):
QE_line = Line(LEFT, RIGHT)
QE_line.set_stroke(YELLOW, 3)
QE_line_update = ContinualUpdateFromFunc(
QE_line_update = ContinualUpdate(
QE_line, lambda l: l.put_start_and_end_on(
Q_dot.get_center(),
self.get_eccentricity_point()
@ -1840,7 +1840,7 @@ class ProveEllipse(ShowEmergingEllipse, ShowEllipseDefiningProperty):
label.rotate(angle, about_point=Q_dot.get_center())
return label
distance_label_rotate_update_animation = ContinualUpdateFromFunc(
distance_label_rotate_update_animation = ContinualUpdate(
self.distance_labels[0],
distance_label_rotate_update
)
@ -2075,7 +2075,7 @@ class ProveEllipse(ShowEmergingEllipse, ShowEllipseDefiningProperty):
else:
line.set_stroke(WHITE, 1)
lines_update_animation = ContinualUpdateFromFunc(
lines_update_animation = ContinualUpdate(
lines, update_lines
)
@ -2356,7 +2356,7 @@ class NonEllipticalKeplersLaw(KeplersSecondLaw):
arrow, arrow_update = self.get_force_arrow_and_update(
comet
)
alt_arrow_update = ContinualUpdateFromFunc(
alt_arrow_update = ContinualUpdate(
arrow, lambda a: a.scale(
1.0 / a.get_length(),
about_point=a.get_start()
@ -2963,7 +2963,7 @@ class IntroduceShapeOfVelocities(AskAboutEllipses, MovingCameraScene):
)
Transform(vector, new_vector).update(1)
moving_vector_animation = ContinualUpdateFromFunc(
moving_vector_animation = ContinualUpdate(
moving_vector, update_moving_vector
)
return moving_vector, moving_vector_animation

View file

@ -569,7 +569,7 @@ class FunctionMinmization(GraphScene):
dot.move_to(self.input_to_graph_point(x, graph))
self.add(*[
ContinualUpdateFromFunc(dot, update_dot)
ContinualUpdate(dot, update_dot)
for dot in dots
])
self.wait(10)
@ -1752,8 +1752,8 @@ class SingleVariableCostFunction(GraphScene):
new_ball.point = point
balls.add(new_ball)
updates += [
ContinualUpdateFromFunc(point, update_point),
ContinualUpdateFromFunc(new_ball, update_ball)
ContinualUpdate(point, update_point),
ContinualUpdate(new_ball, update_ball)
]
balls.set_color_by_gradient(BLUE, GREEN)

View file

@ -691,7 +691,7 @@ class UsingTheta(Scene):
theta = TexMobject("\\theta", "=")
theta[0].match_color(arc)
theta.add_background_rectangle()
update_theta = ContinualUpdateFromFunc(
update_theta = ContinualUpdate(
theta, lambda m : m.shift(
rotate_vector(0.9*RIGHT, radius.get_angle()/2) \
- m[1][0].get_center()

View file

@ -338,7 +338,7 @@ class MentionUncertaintyPrinciple(TeacherStudentsScene):
brace.next_to(gdw, vect)
text.next_to(brace, vect, buff = SMALL_BUFF)
group.set_color(color)
return ContinualUpdateFromFunc(group, update_group)
return ContinualUpdate(group, update_group)
dot_brace_anim = get_brace_text_group_update(
dot_cloud.gaussian_distribution_wrapper,
@ -1705,7 +1705,7 @@ class MentionDopplerRadar(TeacherStudentsScene):
plane.flip()
pulse = RadarPulse(dish, plane)
look_at_anims = [
ContinualUpdateFromFunc(
ContinualUpdate(
pi, lambda pi : pi.look_at(pulse.mobject)
)
for pi in self.get_pi_creatures()
@ -1807,7 +1807,7 @@ class IntroduceDopplerRadar(Scene):
run_time = 0.97*axes.x_max
)
)
randy_look_at = ContinualUpdateFromFunc(
randy_look_at = ContinualUpdate(
randy, lambda pi : pi.look_at(pulse.mobject)
)
axes_anim = ContinualAnimation(axes)
@ -2860,11 +2860,11 @@ class SummarizeFourierTradeoffForDoppler(Scene):
top_graphs = get_top_graphs()
bottom_graphs = get_bottom_graphs()
update_top_graphs = ContinualUpdateFromFunc(
update_top_graphs = ContinualUpdate(
top_graphs,
lambda g : Transform(g, get_top_graphs()).update(1)
)
update_bottom_graphs = ContinualUpdateFromFunc(
update_bottom_graphs = ContinualUpdate(
bottom_graphs,
lambda g : Transform(g, get_bottom_graphs()).update(1)
)
@ -3360,7 +3360,7 @@ class SortOfDopplerEffect(PiCreatureScene):
])
return
wave = get_wave()
wave_update = ContinualUpdateFromFunc(
wave_update = ContinualUpdate(
wave, lambda w : Transform(w, get_wave()).update(1)
)
@ -3369,7 +3369,7 @@ class SortOfDopplerEffect(PiCreatureScene):
rect_movement = ContinualMovement(rect, direction = LEFT, rate = 1)
randy = self.pi_creature
randy_look_at = ContinualUpdateFromFunc(
randy_look_at = ContinualUpdate(
randy, lambda r : r.look_at(rect)
)
@ -3379,7 +3379,7 @@ class SortOfDopplerEffect(PiCreatureScene):
ref_frame2 = TextMobject("Reference frame 2")
ref_frame2.next_to(rect, UP)
# ref_frame2.set_fill(opacity = 0)
ref_frame2_follow = ContinualUpdateFromFunc(
ref_frame2_follow = ContinualUpdate(
ref_frame2, lambda m : m.next_to(rect, UP)
)
ref_frame_1_continual_anim = ContinualAnimation(ref_frame1)
@ -3502,7 +3502,7 @@ class HangingWeightsScene(MovingCameraScene):
d_height = A*np.cos(TAU*f*t - k*x)
new_spring = get_spring(spring.alpha, 2+d_height)
Transform(spring, new_spring).update(1)
spring_update_anim = ContinualUpdateFromFunc(springs, update_springs)
spring_update_anim = ContinualUpdate(springs, update_springs)
self.spring_update_anim = spring_update_anim
spring_update_anim.update(0)
@ -3521,7 +3521,7 @@ class HangingWeightsScene(MovingCameraScene):
weight.start_radius = 0.15
weight.target_radius = 0.25*mass #For future update
weight.spring = spring
weight_anim = ContinualUpdateFromFunc(
weight_anim = ContinualUpdate(
weight, lambda w : w.move_to(w.spring.get_bottom())
)
weight_anim.update(0)
@ -3665,7 +3665,7 @@ class HangingWeightsScene(MovingCameraScene):
de_broglie.set_height(6)
de_broglie.next_to(4*DOWN, DOWN)
self.add(
ContinualUpdateFromFunc(
ContinualUpdate(
randy, lambda m : m.next_to(
rect.get_corner(DOWN+LEFT), UP+RIGHT, MED_LARGE_BUFF,
).look_at(weights)
@ -4101,7 +4101,7 @@ class ProbabalisticDetection(FourierTransformOfWaveFunction):
rect.save_state()
rect.stretch(0, 0)
gdw_anim = ContinualUpdateFromFunc(
gdw_anim = ContinualUpdate(
gdw, lambda m : m.set_width(
2.0/(self.a_tracker.get_value()**(0.5))
).move_to(rect)
@ -4123,7 +4123,7 @@ class ProbabalisticDetection(FourierTransformOfWaveFunction):
answer.submobjects = [yes]
else:
answer.submobjects = [no]
answer_anim = ContinualUpdateFromFunc(answer, update_answer)
answer_anim = ContinualUpdate(answer, update_answer)
self.add(gdw_anim, particle)
self.play(
@ -4339,13 +4339,13 @@ class ThinkOfHeisenbergUncertainty(PiCreatureScene):
freq = 1
continual_anims = [
ContinualMovement(time_tracker, direction = RIGHT, rate = 1),
ContinualUpdateFromFunc(
ContinualUpdate(
dot_gdw,
lambda d : d.set_width(
(np.cos(freq*time_tracker.get_value()) + 1.1)/2
)
),
ContinualUpdateFromFunc(
ContinualUpdate(
vector_gdw,
lambda d : d.set_width(
(-np.cos(freq*time_tracker.get_value()) + 1.1)/2

View file

@ -1199,10 +1199,10 @@ class ShowVectorEquation(Scene):
)
brace.next_to(self.vector.get_center(), DOWN, SMALL_BUFF)
return brace
moving_brace = ContinualUpdateFromFunc(
moving_brace = ContinualUpdate(
Brace(Line(LEFT, RIGHT), DOWN), update_brace
)
moving_x_without_phi = ContinualUpdateFromFunc(
moving_x_without_phi = ContinualUpdate(
x_without_phi.copy().add_background_rectangle(),
lambda m : m.next_to(moving_brace.mobject, DOWN, SMALL_BUFF)
)
@ -1621,7 +1621,7 @@ class ShowTipToTailSum(ShowVectorEquation):
self.v_oscillating_vector.A_vect = [0, 2, 0]
self.v_oscillating_vector.update(0)
self.d_oscillating_vector = ContinualUpdateFromFunc(
self.d_oscillating_vector = ContinualUpdate(
Vector(UP+RIGHT, color = E_COLOR),
lambda v : v.put_start_and_end_on(
ORIGIN,
@ -1696,8 +1696,8 @@ class ShowTipToTailSum(ShowVectorEquation):
self.h_oscillating_vector,
self.v_oscillating_vector,
self.d_oscillating_vector,
ContinualUpdateFromFunc(h_line, h_line.update),
ContinualUpdateFromFunc(v_line, v_line.update),
ContinualUpdate(h_line, h_line.update),
ContinualUpdate(v_line, v_line.update),
)
self.wait(4)
@ -2163,10 +2163,10 @@ class ShowPolarizingFilter(DirectionOfPolarizationScene):
return update_decimal
continual_updates = [
ContinualUpdateFromFunc(
ContinualUpdate(
A_x, generate_decimal_update(np.sin),
),
ContinualUpdateFromFunc(
ContinualUpdate(
A_y, generate_decimal_update(np.cos),
),
]