Get rid of all_at_once

This commit is contained in:
Grant Sanderson 2019-02-08 15:49:06 -08:00
parent f9010f3421
commit cf92cd161e
24 changed files with 43 additions and 45 deletions

View file

@ -16,7 +16,6 @@ class Animation(object):
# Does this animation add or remove a mobject form the screen # Does this animation add or remove a mobject form the screen
"remover": False, "remover": False,
# TODO, replace this with a single lag parameter # TODO, replace this with a single lag parameter
# "submobject_mode": "all_at_once",
# If 0, the animation is applied to all submobjects # If 0, the animation is applied to all submobjects
# at the same time # at the same time

View file

@ -20,7 +20,6 @@ class Transform(Animation):
"path_arc": 0, "path_arc": 0,
"path_arc_axis": OUT, "path_arc_axis": OUT,
"path_func": None, "path_func": None,
"submobject_mode": "all_at_once",
"replace_mobject_with_target_in_scene": False, "replace_mobject_with_target_in_scene": False,
} }
@ -121,7 +120,7 @@ class MoveToTarget(Transform):
class ApplyMethod(Transform): class ApplyMethod(Transform):
CONFIG = { CONFIG = {
"submobject_mode": "all_at_once" "lag_ratio": 0
} }
def __init__(self, method, *args, **kwargs): def __init__(self, method, *args, **kwargs):
@ -185,7 +184,7 @@ class Restore(ApplyMethod):
class ApplyFunction(Transform): class ApplyFunction(Transform):
CONFIG = { CONFIG = {
"submobject_mode": "all_at_once", "lag_ratio": 0,
} }
def __init__(self, function, mobject, **kwargs): def __init__(self, function, mobject, **kwargs):

View file

@ -124,7 +124,7 @@ class NumericalMatrixMultiplication(Scene):
start_parts, start_parts,
result_entry.copy().set_color(YELLOW), result_entry.copy().set_color(YELLOW),
path_arc=-np.pi / 2, path_arc=-np.pi / 2,
submobject_mode="all_at_once", lag_ratio=0,
), ),
*lagging_anims *lagging_anims
) )

View file

@ -236,8 +236,8 @@ class VectorScene(Scene):
) )
self.wait() self.wait()
self.play( self.play(
Transform(x_coord_start, x_coord, submobject_mode="all_at_once"), Transform(x_coord_start, x_coord, lag_ratio=0),
Transform(y_coord_start, y_coord, submobject_mode="all_at_once"), Transform(y_coord_start, y_coord, lag_ratio=0),
Write(brackets, run_time=1), Write(brackets, run_time=1),
) )
self.wait() self.wait()
@ -437,7 +437,7 @@ class LinearTransformationScene(VectorScene):
target = VMobject(*[mob.target for mob in pieces]) target = VMobject(*[mob.target for mob in pieces])
if self.leave_ghost_vectors: if self.leave_ghost_vectors:
self.add(start.copy().fade(0.7)) self.add(start.copy().fade(0.7))
return Transform(start, target, submobject_mode="all_at_once") return Transform(start, target, lag_ratio=0)
def get_moving_mobject_movement(self, func): def get_moving_mobject_movement(self, func):
for m in self.moving_mobjects: for m in self.moving_mobjects:

View file

@ -266,7 +266,7 @@ class MainBreakdown(Scene):
def get_passing_flash(): def get_passing_flash():
return ShowPassingFlash( return ShowPassingFlash(
paths, paths,
submobject_mode = "all_at_once", lag_ratio = 0,
time_width = 0.7, time_width = 0.7,
run_time = 2, run_time = 2,
) )

View file

@ -2631,7 +2631,7 @@ class IPTScene(TwoLightSourcesScene, ZoomedScene):
) )
# Show miniature triangle # Show miniature triangle
self.play(ShowCreation(mini_triangle, submobject_mode = "all_at_once")) self.play(ShowCreation(mini_triangle, lag_ratio = 0))
self.play( self.play(
MoveToTarget(mini_triangle), MoveToTarget(mini_triangle),
run_time = 2, run_time = 2,

View file

@ -781,7 +781,7 @@ class ShowVariousFilterPairs(ShowVariousFilterPairsWithPhotonsOverTime):
kwargs = { kwargs = {
"rate_func" : None, "rate_func" : None,
"submobject_mode" : "all_at_once", "lag_ratio" : 0,
} }
self.play(ShowCreation(lines_to_pf1, run_time = 2./3, **kwargs)) self.play(ShowCreation(lines_to_pf1, run_time = 2./3, **kwargs))
@ -1083,7 +1083,7 @@ class IntroduceLabeledFilters(ShowVariousFilterPairs):
lines_from_C = self.get_lines(C, ratio = 0.5) lines_from_C = self.get_lines(C, ratio = 0.5)
kwargs = { kwargs = {
"rate_func" : None, "rate_func" : None,
"submobject_mode" : "all_at_once", "lag_ratio" : 0,
"run_time" : 1./3, "run_time" : 1./3,
} }
self.play( self.play(
@ -1142,7 +1142,7 @@ class IntroduceLabeledFilters(ShowVariousFilterPairs):
kwargs = { kwargs = {
"rate_func" : None, "rate_func" : None,
"submobject_mode" : "all_at_once", "lag_ratio" : 0,
"run_time" : 1./5, "run_time" : 1./5,
} }
self.play( self.play(
@ -1309,7 +1309,7 @@ class RemoveBFromLabeledFilters(IntroduceLabeledFiltersNoRotation):
line.scale(0.5, about_point = line.get_end()) line.scale(0.5, about_point = line.get_end())
kwargs = { kwargs = {
"submobject_mode" : "all_at_once", "lag_ratio" : 0,
"rate_func" : None, "rate_func" : None,
} }
@ -2440,7 +2440,7 @@ class NoFirstMeasurementPreferenceBasedOnDirection(ShowVariousFilterPairs):
kwargs = { kwargs = {
"rate_func" : None, "rate_func" : None,
"submobject_mode" : "all_at_once" "lag_ratio" : 0
} }
self.play(ShowCreation(all_pre_lines, **kwargs)) self.play(ShowCreation(all_pre_lines, **kwargs))
self.play( self.play(

View file

@ -852,7 +852,7 @@ class WalkEquatorPostTransform(GraphScene):
]) ])
self.play( self.play(
ShowCreation(transverse_curve, submobject_mode = "all_at_once"), ShowCreation(transverse_curve, lag_ratio = 0),
equator_transform, equator_transform,
dots_transform, dots_transform,
run_time = 10, run_time = 10,

View file

@ -824,7 +824,7 @@ class CylinderModel(Scene):
self.play( self.play(
ShowCreationThenDestruction( ShowCreationThenDestruction(
stream_lines_copy, stream_lines_copy,
submobject_mode="all_at_once", lag_ratio=0,
run_time=3, run_time=3,
) )
) )
@ -1118,7 +1118,7 @@ class ElectricField(CylinderModel, MovingCameraScene):
self.play(ShowCreation( self.play(ShowCreation(
h_lines, h_lines,
run_time=2, run_time=2,
submobject_mode="all_at_once" lag_ratio=0
)) ))
self.add(voltage_update) self.add(voltage_update)
self.add_foreground_mobjects(voltage) self.add_foreground_mobjects(voltage)

View file

@ -1572,7 +1572,7 @@ class RecapCircleSolution(GraphRectangles, ReconfigurableScene):
self.play(Write(area_label)) self.play(Write(area_label))
self.play( self.play(
ShowCreation(arrows, submobject_mode = "all_at_once"), ShowCreation(arrows, lag_ratio = 0),
FadeIn(radial_lines), FadeIn(radial_lines),
*[ *[
ReplacementTransform( ReplacementTransform(

View file

@ -1251,7 +1251,7 @@ class GraphOfXCubed(GraphScene):
self.play(Write(label, run_time = 1)) self.play(Write(label, run_time = 1))
self.wait() self.wait()
self.play(Write(deriv_label, run_time = 1)) self.play(Write(deriv_label, run_time = 1))
self.play(ShowCreation(ss_group, submobject_mode = "all_at_once")) self.play(ShowCreation(ss_group, lag_ratio = 0))
self.animate_secant_slope_group_change( self.animate_secant_slope_group_change(
ss_group, ss_group,
target_x = self.deriv_x_max, target_x = self.deriv_x_max,
@ -2377,7 +2377,7 @@ class DerivativeIntuitionFromSineGraph(GraphScene):
color = RED color = RED
) )
self.play(ShowCreation(ss_group, submobject_mode = "all_at_once")) self.play(ShowCreation(ss_group, lag_ratio = 0))
self.play(ShowCreation(v_line)) self.play(ShowCreation(v_line))
self.wait() self.wait()
last_theta = 0 last_theta = 0

View file

@ -1891,7 +1891,7 @@ class AlternateExample(ZoomedScene):
ShowCreation( ShowCreation(
graphs, graphs,
run_time = 3, run_time = 3,
submobject_mode = "all_at_once" lag_ratio = 0
), ),
Animation(self.formula) Animation(self.formula)
) )

View file

@ -659,7 +659,7 @@ class TrackBasisVectorsExample(LinearTransformationScene):
self.play(Transform( self.play(Transform(
pre_def, v_def, pre_def, v_def,
run_time = 2, run_time = 2,
submobject_mode = "all_at_once" lag_ratio = 0
)) ))
self.remove(pre_def) self.remove(pre_def)
self.add_foreground_mobject(v_def) self.add_foreground_mobject(v_def)
@ -907,7 +907,7 @@ class MatrixVectorMultiplication(LinearTransformationScene):
Transform(i_brackets, matrix_brackets), Transform(i_brackets, matrix_brackets),
Transform(j_brackets, matrix_brackets), Transform(j_brackets, matrix_brackets),
run_time = 2, run_time = 2,
submobject_mode = "all_at_once" lag_ratio = 0
) )
everything = VMobject(*self.get_mobjects()) everything = VMobject(*self.get_mobjects())
self.play( self.play(
@ -995,7 +995,7 @@ class MatrixVectorMultiplication(LinearTransformationScene):
Transform( Transform(
formula_start, formula, formula_start, formula,
run_time = 2, run_time = 2,
submobject_mode = "all_at_once" lag_ratio = 0
) )
) )
self.wait() self.wait()
@ -1045,7 +1045,7 @@ class MatrixVectorMultiplication(LinearTransformationScene):
self.play( self.play(
Transform( Transform(
start_state, end_state, start_state, end_state,
submobject_mode = "all_at_once" lag_ratio = 0
), ),
Write(equals, run_time = 1) Write(equals, run_time = 1)
) )
@ -1404,7 +1404,7 @@ class UsedToThinkinfOfFunctionsAsGraphs(VectorScene):
self.play( self.play(
ApplyPointwiseFunction( ApplyPointwiseFunction(
collapse_func, axes, collapse_func, axes,
submobject_mode = "all_at_once", lag_ratio = 0,
), ),
ApplyPointwiseFunction(collapse_func, graph), ApplyPointwiseFunction(collapse_func, graph),
ApplyMethod(point.shift, 10*DOWN), ApplyMethod(point.shift, 10*DOWN),
@ -1714,7 +1714,7 @@ class ReasonForThinkingAboutArrows(LinearTransformationScene):
self.wait() self.wait()
self.play(Transform( self.play(Transform(
vectors, vectors_copy, vectors, vectors_copy,
submobject_mode = "all_at_once" lag_ratio = 0
)) ))
self.wait() self.wait()

View file

@ -1177,7 +1177,7 @@ class WrapCosineGraphAroundCircle(FourierMachineScene):
circle_plane = self.get_circle_plane() circle_plane = self.get_circle_plane()
moving_graph = graph.copy() moving_graph = graph.copy()
self.play(ShowCreation(circle_plane, submobject_mode = "all_at_once")) self.play(ShowCreation(circle_plane, lag_ratio = 0))
self.play(ReplacementTransform( self.play(ReplacementTransform(
moving_graph, moving_graph,
polarized_graph, polarized_graph,
@ -3502,7 +3502,7 @@ class ScaleUpCenterOfMass(WriteComplexExponentialExpression):
bps_label.add_background_rectangle() bps_label.add_background_rectangle()
self.play( self.play(
ShowCreation(v_lines, submobject_mode = "all_at_once"), ShowCreation(v_lines, lag_ratio = 0),
ShowCreation(graph_portion), ShowCreation(graph_portion),
FadeIn(bps_label), FadeIn(bps_label),
) )

View file

@ -44,7 +44,7 @@ class PiCreatureFractalCreation(FractalCreation):
"max_order" : 6, "max_order" : 6,
"fractal_kwargs" : {"height" : 6}, "fractal_kwargs" : {"height" : 6},
"transform_kwargs" : { "transform_kwargs" : {
"submobject_mode" : "all_at_once", "lag_ratio" : 0,
"run_time" : 2, "run_time" : 2,
}, },
} }
@ -65,7 +65,7 @@ class QuadraticKochFractalCreation(FractalCreation):
"max_order" : 5, "max_order" : 5,
"fractal_kwargs" : {"radius" : 10}, "fractal_kwargs" : {"radius" : 10},
# "transform_kwargs" : { # "transform_kwargs" : {
# "submobject_mode" : "all_at_once", # "lag_ratio" : 0,
# "run_time" : 2, # "run_time" : 2,
# }, # },
} }

View file

@ -343,7 +343,7 @@ class MathIsATease(Scene):
self.add(randy) self.add(randy)
self.play( self.play(
ShowCreation(lashes, submobject_mode = "all_at_once"), ShowCreation(lashes, lag_ratio = 0),
randy.change, "tease", randy.change, "tease",
randy.look, OUT, randy.look, OUT,
) )

View file

@ -661,7 +661,7 @@ class LayOutPlan(TeacherStudentsScene, NetworkScene):
), ),
self.get_student_changes( self.get_student_changes(
*["confused"]*3, *["confused"]*3,
submobject_mode = "all_at_once" lag_ratio = 0
), ),
self.teacher.change, "plain", self.teacher.change, "plain",
run_time = 1 run_time = 1

View file

@ -266,7 +266,7 @@ class PreviewLearning(NetworkScene):
self.play( self.play(
ShowCreation( ShowCreation(
delta_edges, submobject_mode = "all_at_once" delta_edges, lag_ratio = 0
), ),
FadeIn(delta_neurons), FadeIn(delta_neurons),
run_time = 0.5 run_time = 0.5

View file

@ -2554,7 +2554,7 @@ class SimplestNetworkExample(PreviewLearning):
self.wait() self.wait()
self.play(MoveToTarget(zL)) self.play(MoveToTarget(zL))
self.play( self.play(
ShowCreation(top_lines, submobject_mode = "all_at_once"), ShowCreation(top_lines, lag_ratio = 0),
top_lines.flash top_lines.flash
) )
self.wait() self.wait()

View file

@ -3705,7 +3705,7 @@ class TwoDStereographicProjection(IntroduceFelix):
self.play( self.play(
ShowCreationThenDestruction( ShowCreationThenDestruction(
sphere_arcs, sphere_arcs,
submobject_mode="all_at_once", lag_ratio=0,
run_time=3, run_time=3,
) )
) )

View file

@ -1346,7 +1346,7 @@ class Lemma1(DistanceProductScene):
arcs.set_stroke(YELLOW, 5) arcs.set_stroke(YELLOW, 5)
show_arcs = ShowCreationThenDestruction( show_arcs = ShowCreationThenDestruction(
arcs, arcs,
submobject_mode="all_at_once", lag_ratio=0,
run_time=2, run_time=2,
) )
@ -1542,7 +1542,7 @@ class FromGeometryToAlgebra(DistanceProductScene):
arc.reverse_points() arc.reverse_points()
arcs_anim = ShowCreationThenDestruction( arcs_anim = ShowCreationThenDestruction(
arcs, submobject_mode="all_at_once", run_time=2 arcs, lag_ratio=0, run_time=2
) )
spacing_words = self.spacing_words = TextMobject("Evenly-spaced") spacing_words = self.spacing_words = TextMobject("Evenly-spaced")
@ -4809,7 +4809,7 @@ class KeeperAndSailorForSineProduct(KeeperAndSailor):
self.wait() self.wait()
self.play( self.play(
# GrowFromCenter(brace), # GrowFromCenter(brace),
ShowCreation(product_lines, submobject_mode="all_at_once"), ShowCreation(product_lines, lag_ratio=0),
FadeIn(product) FadeIn(product)
) )
self.wait() self.wait()

View file

@ -3205,7 +3205,7 @@ class ThreeFilters(ShootPhotonThroughFilter):
l1, l2, l3 = self.lines_group[:3] l1, l2, l3 = self.lines_group[:3]
pf1, pf2, pf3 = self.pol_filters pf1, pf2, pf3 = self.pol_filters
kwargs = { kwargs = {
"submobject_mode" : "all_at_once", "lag_ratio" : 0,
"rate_func" : None, "rate_func" : None,
} }
@ -3685,7 +3685,7 @@ class PhotonAtSlightAngle(ThreeFilters):
FadeIn(self.pol_filter), FadeIn(self.pol_filter),
Animation(self.arc) Animation(self.arc)
) )
self.play(ShowCreation(filter_lines, submobject_mode = "all_at_once")) self.play(ShowCreation(filter_lines, lag_ratio = 0))
self.play(FadeOut(filter_lines)) self.play(FadeOut(filter_lines))
self.wait() self.wait()
@ -3788,7 +3788,7 @@ class PhotonAtSlightAngle(ThreeFilters):
kwargs = { kwargs = {
"rate_func" : None, "rate_func" : None,
"submobject_mode" : "all_at_once", "lag_ratio" : 0,
} }
self.play( self.play(
ShowCreation(arrow), ShowCreation(arrow),

View file

@ -435,7 +435,7 @@ class DefineInscribedSquareProblem(ClosedLoopScene):
self.play( self.play(
ShowCreation( ShowCreation(
self.connecting_lines, self.connecting_lines,
submobject_mode = "all_at_once", lag_ratio = 0,
run_time = 2 run_time = 2
), ),
Animation(self.dots) Animation(self.dots)

View file

@ -346,7 +346,7 @@ class PreviewZetaAndContinuation(ZetaTransformationScene):
self.wait() self.wait()
self.play(ShowCreation( self.play(ShowCreation(
reflected_plane, reflected_plane,
submobject_mode = "all_at_once", lag_ratio = 0,
run_time = 2 run_time = 2
)) ))
self.wait() self.wait()