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
"remover": False,
# TODO, replace this with a single lag parameter
# "submobject_mode": "all_at_once",
# If 0, the animation is applied to all submobjects
# at the same time

View file

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

View file

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

View file

@ -236,8 +236,8 @@ class VectorScene(Scene):
)
self.wait()
self.play(
Transform(x_coord_start, x_coord, submobject_mode="all_at_once"),
Transform(y_coord_start, y_coord, submobject_mode="all_at_once"),
Transform(x_coord_start, x_coord, lag_ratio=0),
Transform(y_coord_start, y_coord, lag_ratio=0),
Write(brackets, run_time=1),
)
self.wait()
@ -437,7 +437,7 @@ class LinearTransformationScene(VectorScene):
target = VMobject(*[mob.target for mob in pieces])
if self.leave_ghost_vectors:
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):
for m in self.moving_mobjects:

View file

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

View file

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

View file

@ -781,7 +781,7 @@ class ShowVariousFilterPairs(ShowVariousFilterPairsWithPhotonsOverTime):
kwargs = {
"rate_func" : None,
"submobject_mode" : "all_at_once",
"lag_ratio" : 0,
}
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)
kwargs = {
"rate_func" : None,
"submobject_mode" : "all_at_once",
"lag_ratio" : 0,
"run_time" : 1./3,
}
self.play(
@ -1142,7 +1142,7 @@ class IntroduceLabeledFilters(ShowVariousFilterPairs):
kwargs = {
"rate_func" : None,
"submobject_mode" : "all_at_once",
"lag_ratio" : 0,
"run_time" : 1./5,
}
self.play(
@ -1309,7 +1309,7 @@ class RemoveBFromLabeledFilters(IntroduceLabeledFiltersNoRotation):
line.scale(0.5, about_point = line.get_end())
kwargs = {
"submobject_mode" : "all_at_once",
"lag_ratio" : 0,
"rate_func" : None,
}
@ -2440,7 +2440,7 @@ class NoFirstMeasurementPreferenceBasedOnDirection(ShowVariousFilterPairs):
kwargs = {
"rate_func" : None,
"submobject_mode" : "all_at_once"
"lag_ratio" : 0
}
self.play(ShowCreation(all_pre_lines, **kwargs))
self.play(

View file

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

View file

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

View file

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

View file

@ -1251,7 +1251,7 @@ class GraphOfXCubed(GraphScene):
self.play(Write(label, run_time = 1))
self.wait()
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(
ss_group,
target_x = self.deriv_x_max,
@ -2377,7 +2377,7 @@ class DerivativeIntuitionFromSineGraph(GraphScene):
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.wait()
last_theta = 0

View file

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

View file

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

View file

@ -1177,7 +1177,7 @@ class WrapCosineGraphAroundCircle(FourierMachineScene):
circle_plane = self.get_circle_plane()
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(
moving_graph,
polarized_graph,
@ -3502,7 +3502,7 @@ class ScaleUpCenterOfMass(WriteComplexExponentialExpression):
bps_label.add_background_rectangle()
self.play(
ShowCreation(v_lines, submobject_mode = "all_at_once"),
ShowCreation(v_lines, lag_ratio = 0),
ShowCreation(graph_portion),
FadeIn(bps_label),
)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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