Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Renaming MED_BUFF constant

Grant Sanderson4c7e04f02fb1
diff --git a/animation/simple_animations.py b/animation/simple_animations.py
index fe29e4471..d74d8731b 100644
--- a/animation/simple_animations.py
+++ b/animation/simple_animations.py
@@ -86,6 +86,43 @@ class Write(ShowCreation):
else:
self.run_time = 3
+class DrawBorderThenFill(Animation):
+ CONFIG = {
+ "run_time" : 2,
+ "stroke_width" : 2,
+ "rate_func" : double_smooth,
+ }
+ def __init__(self, vmobject, **kwargs):
+ if not isinstance(vmobject, VMobject):
+ raise Exception("DrawBorderThenFill only works for VMobjects")
+ self.reached_halfway_point_before = False
+ Animation.__init__(self, vmobject, **kwargs)
+
+ def update_submobject(self, submobject, starting_submobject, alpha):
+ if alpha < 0.5:
+ print 2*alpha
+ submobject.pointwise_become_partial(
+ starting_submobject, 0, 2*alpha
+ )
+ submobject.set_stroke(
+ starting_submobject.get_color(),
+ width = self.stroke_width
+ )
+ submobject.set_fill(opacity = 0)
+ else:
+ if not self.reached_halfway_point_before:
+ self.reached_halfway_point_before = True
+ submobject.points = np.array(starting_submobject.points)
+ width, opacity = [
+ interpolate(start, end, 2*alpha - 1)
+ for start, end in [
+ (self.stroke_width, starting_submobject.get_stroke_width()),
+ (0, starting_submobject.get_fill_opacity())
+ ]
+ ]
+ submobject.set_stroke(width = width)
+ submobject.set_fill(opacity = opacity)
+
class ShowPassingFlash(ShowPartial):
CONFIG = {
diff --git a/constants.py b/constants.py
index 5c3074f9b..0b24c501c 100644
--- a/constants.py
+++ b/constants.py
@@ -33,11 +33,12 @@ SPACE_WIDTH = SPACE_HEIGHT * DEFAULT_WIDTH / DEFAULT_HEIGHT
SMALL_BUFF = 0.1
-MED_BUFF = 0.25
+MED_SMALL_BUFF = 0.25
+MED_LARGE_BUFF = 0.5
LARGE_BUFF = 1
-DEFAULT_MOBJECT_TO_EDGE_BUFFER = MED_BUFF
-DEFAULT_MOBJECT_TO_MOBJECT_BUFFER = MED_BUFF
+DEFAULT_MOBJECT_TO_EDGE_BUFFER = MED_LARGE_BUFF
+DEFAULT_MOBJECT_TO_MOBJECT_BUFFER = MED_SMALL_BUFF
#All in seconds
diff --git a/eoc/chapter1.py b/eoc/chapter1.py
index be791d060..4829116f6 100644
--- a/eoc/chapter1.py
+++ b/eoc/chapter1.py
@@ -49,7 +49,7 @@ class CircleScene(PiCreatureScene):
fill_color = self.fill_color,
fill_opacity = self.fill_opacity,
)
- self.circle.to_corner(self.circle_corner, buff = 2*MED_BUFF)
+ self.circle.to_corner(self.circle_corner, buff = MED_LARGE_BUFF)
self.radius_line = Line(
self.circle.get_center(),
self.circle.get_right(),
@@ -722,7 +722,7 @@ class IntroduceTinyChangeInArea(CircleScene):
two_pi_R.target, lp, dR.target.scale(1./0.7), rp
)
final_area.arrange_submobjects(RIGHT, buff = SMALL_BUFF)
- final_area.next_to(almost_rect, DOWN, buff = 2*MED_BUFF)
+ final_area.next_to(almost_rect, DOWN, buff = MED_LARGE_BUFF)
final_area.highlight(GREEN_A)
final_area[3].highlight(self.dR_color)
change_in_area.shift(0.1*LEFT)
@@ -768,7 +768,7 @@ class IntroduceTinyChangeInArea(CircleScene):
pi_R_squared, plus, two_pi_R_dR, plus2, pi_dR_squared, minus2, pi_R_squared2 = expanded
for subset in two_pi_R_dR[4:7], pi_dR_squared[2:5]:
VGroup(*subset).highlight(self.dR_color)
- expanded.next_to(new_area_form, DOWN, aligned_edge = LEFT, buff = MED_BUFF)
+ expanded.next_to(new_area_form, DOWN, aligned_edge = LEFT, buff = MED_SMALL_BUFF)
expanded.shift(LEFT/2.)
faders = [area_brace, area_word, new_area_brace, new_area_word]
@@ -1258,7 +1258,7 @@ class NameDerivative(IntroduceTinyChangeInArea):
"=", "\\frac{d(\\pi R^2)}{dR}",
"=", "2\\pi R"
)
- dArea_fom.to_edge(UP, buff = 2*MED_BUFF).shift(RIGHT)
+ dArea_fom.to_edge(UP, buff = MED_LARGE_BUFF).shift(RIGHT)
dA, frac_line, dR = VGroup(*dA_dR[:2]), dA_dR[2], VGroup(*dA_dR[3:])
dA.highlight(GREEN_B)
dR.highlight(self.dR_color)
@@ -1369,7 +1369,7 @@ class NameDerivative(IntroduceTinyChangeInArea):
fracs.add(TexMobject("\\cdots \\rightarrow"))
fracs.add(TexMobject("???"))
fracs[-1].gradient_highlight(self.dR_color, self.outer_ring.get_color())
- fracs.arrange_submobjects(RIGHT, buff = 2*MED_BUFF)
+ fracs.arrange_submobjects(RIGHT, buff = MED_LARGE_BUFF)
fracs.to_corner(DOWN+LEFT)
arrows = VGroup()
@@ -1494,7 +1494,7 @@ class DerivativeAsTangentLine(ZoomedScene):
y_axis.add_numbers(5, 10, 15, 20)
y_axis.numbers.shift(0.4*UP+0.5*LEFT)
y_label = TexMobject("A")
- y_label.next_to(y_axis.get_top(), RIGHT, buff = 2*MED_BUFF)
+ y_label.next_to(y_axis.get_top(), RIGHT, buff = MED_LARGE_BUFF)
def func(alpha):
R = interpolate(self.R_min, self.R_max, alpha)
@@ -1815,7 +1815,7 @@ class IntroduceConcentricRings(CircleScene):
area_sum.add(*dots_equals_area)
area_sum.arrange_submobjects()
area_sum.to_edge(RIGHT)
- area_sum.to_edge(UP, buff = MED_BUFF)
+ area_sum.to_edge(UP, buff = MED_SMALL_BUFF)
dots_equals_area[-1].shift(0.1*UP)
self.area_sum_rhs = dots_equals_area[-1]
@@ -2043,7 +2043,7 @@ class IntroduceConcentricRings(CircleScene):
"an approximation?"
)
question.next_to(approx, DOWN, buff = 1.3*LARGE_BUFF)
- arrow = Arrow(question, approx, buff = MED_BUFF)
+ arrow = Arrow(question, approx, buff = MED_SMALL_BUFF)
approach_words = TextMobject("Consider\\\\", "$dr \\to 0$")
approach_words.move_to(question, RIGHT)
int_brace = Brace(self.integral_expression)
@@ -2401,8 +2401,8 @@ class FundamentalTheorem(CircleScene):
self.play(
FadeOut(self.derivative_terms[0]),
FadeOut(self.integral_terms[0]),
- self.derivative_terms[1].to_corner, UP+LEFT, 2*MED_BUFF,
- self.integral_terms[1].to_corner, UP+RIGHT, 2*MED_BUFF,
+ self.derivative_terms[1].to_corner, UP+LEFT, MED_LARGE_BUFF,
+ self.integral_terms[1].to_corner, UP+RIGHT, MED_LARGE_BUFF,
self.pi_creature.change_mode, "speaking"
)
self.introduce_circle()
@@ -2605,13 +2605,13 @@ class PatreonThanks(Scene):
for patrons in left_patrons, right_patrons:
patrons.arrange_submobjects(
DOWN, aligned_edge = LEFT,
- buff = 1.5*MED_BUFF
+ buff = 1.5*MED_SMALL_BUFF
)
all_patrons = VGroup(left_patrons, right_patrons)
if all_patrons.get_height() > self.max_patrons_height:
all_patrons.scale_to_fit_height(self.max_patrons_height)
for patrons, vect in (left_patrons, LEFT), (right_patrons, RIGHT):
- patrons.to_edge(vect, buff = MED_BUFF)
+ patrons.to_edge(vect, buff = MED_SMALL_BUFF)
# shift_distance = max(
# 0, 1-SPACE_HEIGHT-all_patrons.get_bottom()[1]
diff --git a/eoc/chapter2.py b/eoc/chapter2.py
index 621129d0b..839fdf4a5 100644
--- a/eoc/chapter2.py
+++ b/eoc/chapter2.py
@@ -904,7 +904,7 @@ class VelocityAtIndividualPointsVsPairs(GraphCarTrajectory):
label = "v(t)",
proportion = self.start_time/10.0,
direction = UP,
- buff = MED_BUFF
+ buff = MED_SMALL_BUFF
)
velocity_graph.add(velocity_label)
@@ -1462,7 +1462,7 @@ class SecantLineToTangentLine(GraphCarTrajectory, DefineTrueDerivative):
brace, text = self.get_brace_and_text(deriv_frac)
deriv_def = VGroup(lhs, deriv_frac, brace, text)
deriv_word = TextMobject("Derivative")
- deriv_word.next_to(deriv_def, UP, buff = 2*MED_BUFF)
+ deriv_word.next_to(deriv_def, UP, buff = MED_LARGE_BUFF)
deriv_def.add(deriv_word)
rect = Rectangle(color = WHITE)
rect.replace(deriv_def, stretch = True)
@@ -1709,7 +1709,7 @@ class TCubedExample(SecantLineToTangentLine):
v_lines = self.get_vertical_lines()
lhs = TexMobject("\\frac{ds}{dt}(2) = ")
- lhs.next_to(ds_dt_group, UP+RIGHT, buff = 2*MED_BUFF)
+ lhs.next_to(ds_dt_group, UP+RIGHT, buff = MED_LARGE_BUFF)
ds = VGroup(*lhs[:2])
dt = VGroup(*lhs[3:5])
ds.highlight(DISTANCE_COLOR)
@@ -1908,7 +1908,7 @@ class TCubedExample(SecantLineToTangentLine):
arrow = Arrow(
self.lhs[4].get_bottom(), terms[1][2].get_top(),
color = WHITE,
- buff = MED_BUFF
+ buff = MED_SMALL_BUFF
)
brace = Brace(VGroup(terms[2][0], terms[3][-1]), DOWN)
brace_text = brace.get_text("Contains $dt$")
@@ -1960,7 +1960,7 @@ class TCubedExample(SecantLineToTangentLine):
)
arrow = Arrow(
self.rhs.get_bottom(), deriv_term.target.get_top(),
- buff = MED_BUFF,
+ buff = MED_SMALL_BUFF,
color = WHITE
)
approach_text = TextMobject("As $dt \\to 0$")
@@ -2111,7 +2111,7 @@ class ContrastConcreteDtWithLimit(Scene):
l_formula[27:29],
l_formula[35:37],
)).highlight(TIME_COLOR)
- l_formula.scale_to_fit_width(SPACE_WIDTH-2*MED_BUFF)
+ l_formula.scale_to_fit_width(SPACE_WIDTH-MED_LARGE_BUFF)
l_formula.to_edge(LEFT)
l_brace = Brace(l_formula, DOWN)
diff --git a/eoc/chapter3.py b/eoc/chapter3.py
index ba7a1870d..15d463bc4 100644
--- a/eoc/chapter3.py
+++ b/eoc/chapter3.py
@@ -57,11 +57,11 @@ class DerivativeOfXSquaredAsGraph(GraphScene, ZoomedScene, PiCreatureScene):
"start_x" : 2,
"big_x" : 3,
"dx" : 0.1,
- "x_min" : -5,
- "x_labeled_nums" : range(-4, 0, 2) + range(2, 10, 2),
+ "x_min" : -9,
+ "x_labeled_nums" : range(-8, 0, 2) + range(2, 10, 2),
"y_labeled_nums" : range(2, 12, 2),
- "little_rect_nudge" : 0.5*(2*UP+RIGHT),
- "graph_origin" : 2.5*DOWN + 2*LEFT,
+ "little_rect_nudge" : 0.5*(1.5*UP+RIGHT),
+ "graph_origin" : 2.5*DOWN + LEFT,
"zoomed_canvas_corner" : UP+LEFT,
}
def construct(self):
@@ -107,7 +107,7 @@ class DerivativeOfXSquaredAsGraph(GraphScene, ZoomedScene, PiCreatureScene):
df_dx.next_to(
self.input_to_graph_point(self.start_x, self.graph),
DOWN+RIGHT,
- buff = MED_BUFF
+ buff = MED_SMALL_BUFF
)
self.play(ShowCreation(v_line))
@@ -117,21 +117,19 @@ class DerivativeOfXSquaredAsGraph(GraphScene, ZoomedScene, PiCreatureScene):
self.add(nudged_v_line)
self.dither()
self.activate_zooming()
+ self.little_rectangle.replace(self.big_rectangle)
self.play(
FadeIn(self.little_rectangle),
FadeIn(self.big_rectangle),
)
self.play(
- self.little_rectangle.scale_to_fit_width,
- 4*self.dx,
- self.little_rectangle.move_to,
- self.input_to_graph_point(self.start_x, self.graph),
- self.little_rectangle.shift,
- self.dx*self.little_rect_nudge,
+ ApplyFunction(
+ lambda r : self.position_little_rectangle(r, ss_group),
+ self.little_rectangle
+ ),
self.pi_creature.change_mode, "pondering",
self.pi_creature.look_at, ss_group
)
- self.dither()
self.play(
ShowCreation(ss_group.dx_line),
Write(ss_group.dx_label),
@@ -149,13 +147,20 @@ class DerivativeOfXSquaredAsGraph(GraphScene, ZoomedScene, PiCreatureScene):
]))
self.ss_group = ss_group
+ def position_little_rectangle(self, rect, ss_group):
+ rect.scale_to_fit_width(3*self.dx)
+ rect.move_to(
+ ss_group.dx_line.get_left()
+ )
+ rect.shift(
+ self.dx*self.little_rect_nudge
+ )
+ return rect
+
def show_differing_slopes(self):
ss_group = self.ss_group
def rect_update(rect):
- rect.move_to(ss_group.dx_line.get_left())
- rect.shift(self.dx*self.little_rect_nudge)
- return rect
-
+ self.position_little_rectangle(rect, ss_group)
self.play(
ShowCreation(ss_group.secant_line),
@@ -173,15 +178,76 @@ class DerivativeOfXSquaredAsGraph(GraphScene, ZoomedScene, PiCreatureScene):
self.dither()
def mention_alternate_view(self):
- # self.remove(self.pi_creature)
- # everything = VGroup(*self.get_mobjects())
- # self.add(self.pi_creature)
- # self.disactivate_zooming()
- # self.play(FadeOut(everything))
-
+ self.remove(self.pi_creature)
+ everything = VGroup(*self.get_mobjects())
+ self.add(self.pi_creature)
+ self.disactivate_zooming()
+ self.play(
+ ApplyMethod(
+ everything.shift, 2*SPACE_WIDTH*LEFT,
+ rate_func = lambda t : running_start(t, -0.1)
+ ),
+ self.pi_creature.change_mode, "happy"
+ )
self.say("Let's try \\\\ another view.", target_mode = "speaking")
self.dither(2)
+class NudgeSideLengthOfSquare(PiCreatureScene):
+ CONFIG = {
+ "square_width" : 3,
+ "dx" : 0.5,
+ }
+ def construct(self):
+ ApplyMethod(self.pi_creature.change_mode, "speaking").update(1)
+ self.add_function_label()
+ self.introduce_square()
+ self.increase_area()
+ self.examine_thin_rectangles()
+ self.examine_tiny_square()
+ self.write_out_derivative()
+ self.shrink_dx()
+
+ def add_function_label(self):
+ label = TexMobject("f(x) = x^2")
+ label.next_to(ORIGIN, RIGHT)
+ label.to_edge(UP)
+ self.add(label)
+
+ def introduce_square(self):
+ square = Square(
+ side_length = self.square_width,
+ stroke_width = 0,
+ fill_opacity = 0.75,
+ fill_color = BLUE,
+ )
+ square.to_corner(UP+LEFT, buff = LARGE_BUFF)
+ x_squared = TexMobject("x^2")
+ x_squared.move_to(square)
+
+ braces = VGroup()
+ for vect in DOWN, RIGHT:
+ brace = Brace(square, vect)
+ brace.add(brace.get_text("$x$"))
+ braces.add(brace)
+
+ self.play(DrawBorderThenFill(square))
+ self.add(square, x_squared, braces)
+
+
+ def increase_area(self):
+ pass
+
+ def examine_thin_rectangles(self):
+ pass
+
+ def examine_tiny_square(self):
+ pass
+
+ def write_out_derivative(self):
+ pass
+
+ def shrink_dx(self):
+ pass
diff --git a/eoc/graph_scene.py b/eoc/graph_scene.py
index f6d2448b8..cbb26708b 100644
--- a/eoc/graph_scene.py
+++ b/eoc/graph_scene.py
@@ -72,7 +72,7 @@ class GraphScene(Scene):
y_axis.add_numbers(*self.y_labeled_nums)
y_axis.numbers.shift(self.y_axis_numbers_nudge)
y_label = TextMobject(self.y_axis_label)
- y_label.next_to(y_axis.get_top(), RIGHT, buff = 2*MED_BUFF)
+ y_label.next_to(y_axis.get_top(), RIGHT, buff = MED_LARGE_BUFF)
y_label.shift_onto_screen()
y_axis.add(y_label)
self.y_axis_label_mob = y_label
@@ -130,7 +130,7 @@ class GraphScene(Scene):
label = "f(x)",
x_val = None,
direction = RIGHT,
- buff = MED_BUFF,
+ buff = MED_SMALL_BUFF,
color = None,
):
label = TexMobject(label)
@@ -224,14 +224,17 @@ class GraphScene(Scene):
interim_point, p2,
color = df_line_color
)
+ group.add(group.dx_line, group.df_line)
labels = VGroup()
if dx_label is not None:
group.dx_label = TexMobject(dx_label)
labels.add(group.dx_label)
+ group.add(group.dx_label)
if df_label is not None:
group.df_label = TexMobject(df_label)
labels.add(group.df_label)
+ group.add(group.df_label)
if len(labels) > 0:
max_width = 0.8*group.dx_line.get_width()
@@ -259,8 +262,8 @@ class GraphScene(Scene):
group.secant_line.scale_in_place(
secant_line_length/group.secant_line.get_length()
)
+ group.add(group.secant_line)
- group.digest_mobject_attrs()
return group
def animate_secant_slope_group_change(
diff --git a/fractal_dimension.py b/fractal_dimension.py
index 0ad1028f4..20179b19b 100644
--- a/fractal_dimension.py
+++ b/fractal_dimension.py
@@ -308,7 +308,7 @@ class SelfSimilarFractalsAsSubset(Scene):
self.small_rect = small_rect
group = VGroup(fractals, title, small_rect)
- group.to_corner(UP+LEFT, buff = 2*MED_BUFF)
+ group.to_corner(UP+LEFT, buff = MED_LARGE_BUFF)
self.play(
Write(title),
@@ -320,13 +320,13 @@ class SelfSimilarFractalsAsSubset(Scene):
def add_general_fractals(self):
big_rectangle = Rectangle(
- width = 2*SPACE_WIDTH - 2*MED_BUFF,
- height = 2*SPACE_HEIGHT - 2*MED_BUFF,
+ width = 2*SPACE_WIDTH - MED_LARGE_BUFF,
+ height = 2*SPACE_HEIGHT - MED_LARGE_BUFF,
)
title = TextMobject("Fractals")
title.scale(1.5)
title.next_to(ORIGIN, RIGHT, buff = LARGE_BUFF)
- title.to_edge(UP, buff = 2*MED_BUFF)
+ title.to_edge(UP, buff = MED_LARGE_BUFF)
britain = Britain(
fill_opacity = 0,
@@ -654,7 +654,7 @@ class FourSelfSimilarShapes(Scene):
shapes = VGroup(line, square, cube, sierpinski)
for shape, title in zip(shapes, titles):
shape.scale_to_fit_width(self.shape_width)
- shape.next_to(title, DOWN, buff = MED_BUFF)
+ shape.next_to(title, DOWN, buff = MED_SMALL_BUFF)
line.shift(DOWN)
return shapes
@@ -729,7 +729,7 @@ class FourSelfSimilarShapes(Scene):
])
for label, shape in zip(labels, self.shapes_copy):
label.next_to(shape, DOWN)
- label.to_edge(DOWN, buff = 2*MED_BUFF)
+ label.to_edge(DOWN, buff = MED_LARGE_BUFF)
if label is labels[-1]:
label.shift(0.1*UP) #Dumb
@@ -766,7 +766,7 @@ class GeneralWordForMeasurement(Scene):
Line(
measure.get_bottom(), word.get_top(),
color = word.get_color(),
- buff = MED_BUFF
+ buff = MED_SMALL_BUFF
)
for word in words
])
@@ -946,7 +946,7 @@ class DefineTwoDimensional(PiCreatureScene):
"dimension_color" : YELLOW,
"shape_width" : 2,
"scale_factor" : 0.5,
- "bottom_shape_buff" : MED_BUFF,
+ "bottom_shape_buff" : MED_SMALL_BUFF,
"scalar" : "s",
}
def construct(self):
@@ -978,7 +978,7 @@ class DefineTwoDimensional(PiCreatureScene):
def add_shape(self):
shape = self.get_shape()
shape.scale_to_fit_width(self.shape_width)
- shape.next_to(self.title, DOWN, buff = 2*MED_BUFF)
+ shape.next_to(self.title, DOWN, buff = MED_LARGE_BUFF)
# self.shape.shift(SPACE_HEIGHT*UP/2)
self.mass_color = shape.get_color()
self.add(shape)
@@ -1008,7 +1008,7 @@ class DefineTwoDimensional(PiCreatureScene):
for group in top_group, bottom_group:
group.arrange_submobjects(
DOWN,
- buff = 2*MED_BUFF,
+ buff = MED_LARGE_BUFF,
aligned_edge = LEFT
)
group[0][-1].highlight(self.length_color)
@@ -1149,12 +1149,12 @@ class DefineSierpinskiDimension(DefineTwoDimensional):
simpler_equation = TexMobject("2^D = 3")
simpler_equation[1].highlight(self.dimension_color)
simpler_equation.scale(self.equation_scale_factor)
- simpler_equation.next_to(equation, DOWN, buff = 2*MED_BUFF)
+ simpler_equation.next_to(equation, DOWN, buff = MED_LARGE_BUFF)
log_expression = TexMobject("\\log_2(3) \\approx", "1.585")
log_expression[-1].highlight(self.dimension_color)
log_expression.scale(self.equation_scale_factor)
- log_expression.next_to(simpler_equation, DOWN, buff = 2*MED_BUFF)
+ log_expression.next_to(simpler_equation, DOWN, buff = MED_LARGE_BUFF)
log_expression.shift_onto_screen()
self.play(Write(simpler_equation))
@@ -1388,7 +1388,7 @@ class DimensionOfKoch(Scene):
log_expression.next_to(
simpler_formula, DOWN,
aligned_edge = LEFT,
- buff = 2*MED_BUFF
+ buff = MED_LARGE_BUFF
)
third = self.scaling_factor_mob.copy()
@@ -1455,7 +1455,7 @@ class DimensionOfQuadraticKoch(DimensionOfKoch):
self.add(seed_label, seed)
self.dither()
self.play(
- curve.next_to, resulting_fractal, DOWN, 2*MED_BUFF,
+ curve.next_to, resulting_fractal, DOWN, MED_LARGE_BUFF,
Write(resulting_fractal, run_time = 1)
)
for order in range(2, self.koch_curve_order+1):
@@ -1833,7 +1833,7 @@ class BoxCountingScene(Scene):
self.play(ShowCreation(boxes, run_time = 3))
self.play(Write(num))
self.play(
- num.next_to, self.counting_num_reference, RIGHT, MED_BUFF, DOWN,
+ num.next_to, self.counting_num_reference, RIGHT, MED_SMALL_BUFF, DOWN,
num.highlight, YELLOW
)
return num
@@ -2188,7 +2188,7 @@ class GiveShapeAndPonder(Scene):
norway = Norway(fill_opacity = 0, stroke_width = 1)
norway.scale_to_fit_width(2)
- norway.next_to(morty, UP+LEFT, buff = -MED_BUFF)
+ norway.next_to(morty, UP+LEFT, buff = -MED_SMALL_BUFF)
self.play(
morty.change_mode, "raise_right_hand",
@@ -2898,7 +2898,7 @@ class MortyLookingAtRectangle(Scene):
url.next_to(morty.get_corner(UP+LEFT), UP)
affirm_logo = AffirmLogo()[0]
- affirm_logo.to_corner(UP+RIGHT, buff = 2*MED_BUFF)
+ affirm_logo.to_corner(UP+RIGHT, buff = MED_LARGE_BUFF)
affirm_logo.shift(0.5*DOWN)
self.add(morty)
diff --git a/helpers.py b/helpers.py
index 0970c93ab..5b0953320 100644
--- a/helpers.py
+++ b/helpers.py
@@ -421,6 +421,12 @@ def rush_from(t):
def slow_into(t):
return np.sqrt(1-(1-t)*(1-t))
+def double_smooth(t):
+ if t < 0.5:
+ return 0.5*smooth(2*t)
+ else:
+ return 0.5*(1 + smooth(2*t - 1))
+
def there_and_back(t, inflection = 10.0):
new_t = 2*t if t < 0.5 else 2*(1 - t)
return smooth(new_t, inflection)
diff --git a/mobject/mobject.py b/mobject/mobject.py
index 96bc986ff..2e1c9e89f 100644
--- a/mobject/mobject.py
+++ b/mobject/mobject.py
@@ -266,7 +266,9 @@ class Mobject(object):
space_lengths = [SPACE_WIDTH, SPACE_HEIGHT]
for vect in UP, DOWN, LEFT, RIGHT:
dim = np.argmax(np.abs(vect))
- if abs(self.get_edge_center(vect)[dim]) > space_lengths[dim]:
+ buff = kwargs.get("buff", DEFAULT_MOBJECT_TO_EDGE_BUFFER)
+ max_val = space_lengths[dim] - buff
+ if abs(self.get_edge_center(vect)[dim]) > max_val:
self.to_edge(vect, **kwargs)
return self
diff --git a/mobject/vectorized_mobject.py b/mobject/vectorized_mobject.py
index 3992c34e4..27a6452c9 100644
--- a/mobject/vectorized_mobject.py
+++ b/mobject/vectorized_mobject.py
@@ -345,8 +345,8 @@ class VMobject(Mobject):
return self
self.mark_paths_closed = False
num_cubics = mobject.get_num_anchor_points()-1
- lower_index = np.floor(a*num_cubics)
- upper_index = np.ceil(b*num_cubics)
+ lower_index = int(a*num_cubics)
+ upper_index = int(b*num_cubics)
points = np.array(
mobject.points[3*lower_index:3*upper_index+4]
)
diff --git a/old_projects/eola/chapter10.py b/old_projects/eola/chapter10.py
index 8d2b4ad6e..29f8f033f 100644
--- a/old_projects/eola/chapter10.py
+++ b/old_projects/eola/chapter10.py
@@ -92,7 +92,7 @@ class StudentsFindThisConfusing(TeacherStudentsScene):
question2.target.next_to(
question1, DOWN,
aligned_edge = LEFT,
- buff = MED_BUFF
+ buff = MED_SMALL_BUFF
)
equation = TexMobject(
"\\det\\left( %s \\right)=0"%matrix_to_tex_string([
@@ -142,13 +142,13 @@ class ManyPrerequisites(Scene):
]
for rect, word in zip(rects, words):
word_mob = TextMobject(word)
- word_mob.next_to(rect, UP, buff = MED_BUFF)
+ word_mob.next_to(rect, UP, buff = MED_SMALL_BUFF)
rect.add(word_mob)
Matrix(np.array(rects).reshape((2, 2)))
rects = VGroup(*rects)
rects.scale_to_fit_height(2*SPACE_HEIGHT - 1.5)
- rects.next_to(h_line, DOWN, buff = MED_BUFF)
+ rects.next_to(h_line, DOWN, buff = MED_SMALL_BUFF)
self.play(Write(rects[0]))
self.dither()
@@ -166,7 +166,7 @@ class ExampleTranformationScene(LinearTransformationScene):
def add_matrix(self):
matrix = Matrix(self.t_matrix.T)
matrix.highlight_columns(X_COLOR, Y_COLOR)
- matrix.next_to(ORIGIN, LEFT, buff = MED_BUFF)
+ matrix.next_to(ORIGIN, LEFT, buff = MED_SMALL_BUFF)
matrix.to_edge(UP)
matrix.rect = BackgroundRectangle(matrix)
matrix.add_to_back(matrix.rect)
@@ -225,7 +225,7 @@ class VectorKnockedOffSpan(ExampleTranformationScene):
all_words.shift(
line.point_from_proportion(0.75) - \
span_label.get_corner(DOWN+RIGHT) + \
- MED_BUFF*LEFT
+ MED_SMALL_BUFF*LEFT
)
for text in all_words:
text.add_to_back(BackgroundRectangle(text))
@@ -385,8 +385,8 @@ class FullSneakyEigenspace(ExampleTranformationScene):
vectors.gradient_highlight(MAROON_B, YELLOW)
words = TextMobject("Stretch by 2")
words.add_background_rectangle()
- words.next_to(ORIGIN, DOWN+LEFT, buff = MED_BUFF)
- words.shift(MED_BUFF*LEFT)
+ words.next_to(ORIGIN, DOWN+LEFT, buff = MED_SMALL_BUFF)
+ words.shift(MED_SMALL_BUFF*LEFT)
words.rotate(vectors[0].get_angle())
words.start = words.copy()
words.start.scale(0.5)
@@ -649,7 +649,7 @@ class DeduceTransformationFromMatrix(ColumnsToBasisVectors):
to our coordinate system
""")
words.add_background_rectangle()
- words.next_to(ORIGIN, DOWN+LEFT, buff = MED_BUFF)
+ words.next_to(ORIGIN, DOWN+LEFT, buff = MED_SMALL_BUFF)
words.shift_onto_screen()
self.play(Write(words))
self.dither()
@@ -998,7 +998,7 @@ class NonZeroSolutionsVisually(LinearTransformationScene):
equation.highlight_by_tex("\\lambda", MAROON_B)
equation.highlight_by_tex("\\vec{\\textbf{v}}", YELLOW)
equation.add_background_rectangle()
- equation.next_to(ORIGIN, DOWN, buff = MED_BUFF)
+ equation.next_to(ORIGIN, DOWN, buff = MED_SMALL_BUFF)
equation.to_edge(LEFT)
det_equation = TexMobject(
@@ -1007,7 +1007,7 @@ class NonZeroSolutionsVisually(LinearTransformationScene):
)
det_equation_matrix = VGroup(*det_equation[2:2+4])
det_equation.highlight_by_tex("\\lambda", MAROON_B)
- det_equation.next_to(equation, DOWN, buff = MED_BUFF)
+ det_equation.next_to(equation, DOWN, buff = MED_SMALL_BUFF)
det_equation.to_edge(LEFT)
det_equation.add_background_rectangle()
@@ -1598,7 +1598,7 @@ class SolveRotationEigenvalues(Rotate90Degrees):
)
polynomial.highlight_by_tex("\\lambda^2", MAROON_B)
polynomial.add_background_rectangle()
- polynomial.next_to(equals, DOWN, buff = 2*MED_BUFF, aligned_edge = LEFT)
+ polynomial.next_to(equals, DOWN, buff = MED_LARGE_BUFF, aligned_edge = LEFT)
self.play(Write(polynomial))
self.dither()
@@ -1608,7 +1608,7 @@ class SolveRotationEigenvalues(Rotate90Degrees):
)
result.highlight_by_tex("\\lambda", MAROON_B)
result.add_background_rectangle()
- result.next_to(polynomial, DOWN, buff = 2*MED_BUFF, aligned_edge = LEFT)
+ result.next_to(polynomial, DOWN, buff = MED_LARGE_BUFF, aligned_edge = LEFT)
self.play(Write(result))
self.dither()
@@ -1665,8 +1665,8 @@ class ShearExample(RevisitExampleTransformation):
for word in words:
word.highlight_by_tex("1", MAROON_B)
word.add_to_back(BackgroundRectangle(word))
- words.arrange_submobjects(DOWN, buff = MED_BUFF)
- words.next_to(ORIGIN, DOWN+RIGHT, buff = MED_BUFF)
+ words.arrange_submobjects(DOWN, buff = MED_SMALL_BUFF)
+ words.next_to(ORIGIN, DOWN+RIGHT, buff = MED_SMALL_BUFF)
self.play(ShowCreation(vectors), run_time = 2)
self.play(Write(words))
self.dither()
@@ -1814,7 +1814,7 @@ class IntroduceEigenbasis(TeacherStudentsScene):
)
self.random_blink()
new_words = VGroup(words1.copy(), words2)
- new_words.arrange_submobjects(DOWN, buff = MED_BUFF)
+ new_words.arrange_submobjects(DOWN, buff = MED_SMALL_BUFF)
new_words.scale(0.8)
self.teacher.bubble.add_content(new_words)
self.play(
@@ -2103,7 +2103,7 @@ class LastVideo(Scene):
title.to_edge(UP)
rect = Rectangle(width = 16, height = 9, color = BLUE)
rect.scale_to_fit_height(6)
- rect.next_to(title, DOWN, buff = MED_BUFF)
+ rect.next_to(title, DOWN, buff = MED_SMALL_BUFF)
self.add(title)
self.play(ShowCreation(rect))
@@ -2155,7 +2155,7 @@ class ChangeToEigenBasis(ExampleTranformationScene):
new_words = TextMobject("Use eigenvectors as basis")
for text in words, new_words:
text.add_background_rectangle()
- text.next_to(ORIGIN, DOWN+LEFT, buff = MED_BUFF)
+ text.next_to(ORIGIN, DOWN+LEFT, buff = MED_SMALL_BUFF)
# text.to_edge(RIGHT)
self.play(Write(words))
@@ -2279,7 +2279,7 @@ class ChangeToEigenBasis(ExampleTranformationScene):
hundred = TexMobject("100").scale(0.7)
hundred.next_to(matrix_copy.get_corner(UP+RIGHT), RIGHT)
compute = TextMobject("Compute")
- compute.next_to(matrix_copy, LEFT, buff = MED_BUFF)
+ compute.next_to(matrix_copy, LEFT, buff = MED_SMALL_BUFF)
words = VGroup(compute, matrix_copy, hundred)
bubble.add_content(words)
diff --git a/old_projects/eola/chapter11.py b/old_projects/eola/chapter11.py
index 7fe56c997..610f662f2 100644
--- a/old_projects/eola/chapter11.py
+++ b/old_projects/eola/chapter11.py
@@ -65,7 +65,7 @@ class OpeningQuote(Scene):
words.to_edge(UP)
author = TextMobject("-Vladmir Arnold")
author.highlight(YELLOW)
- author.next_to(words, DOWN, buff = 2*MED_BUFF)
+ author.next_to(words, DOWN, buff = MED_LARGE_BUFF)
self.play(Write(words, run_time = 8))
self.dither()
@@ -136,7 +136,7 @@ class WhatIsA2DVector(LinearTransformationScene):
students = [physics_student, cs_student]
for student, vect in zip(students, [LEFT, RIGHT]):
student.change_mode("confused")
- student.to_corner(DOWN+vect, buff = 2*MED_BUFF)
+ student.to_corner(DOWN+vect, buff = MED_LARGE_BUFF)
student.look_at(v)
student.bubble = get_small_bubble(
student, height = 4, width = 4,
@@ -309,7 +309,7 @@ class AskAbout4DPhysicsStudent(Scene):
thought_mobs.append(group)
group.shift(
physy.bubble.get_top() -\
- tex.get_top() + MED_BUFF*DOWN
+ tex.get_top() + MED_SMALL_BUFF*DOWN
)
line.shift(DOWN)
curr_mob = thought_mobs[0]
@@ -827,7 +827,7 @@ class ScaleFunction(FunctionGraphScene):
title = TexMobject("(2f)", "(x) = 2", "f", "(x)")
title.highlight_by_tex("(2f)", scaled_graph.get_color())
title.highlight_by_tex("f", graph.get_color())
- title.next_to(ORIGIN, LEFT, buff = MED_BUFF)
+ title.next_to(ORIGIN, LEFT, buff = MED_SMALL_BUFF)
title.to_edge(UP)
self.add(title)
@@ -986,7 +986,7 @@ class FromVectorsToFunctions(VectorScene):
equals, new_func
)
group.arrange_submobjects()
- group.shift(2*UP).to_edge(LEFT, buff = 2*MED_BUFF)
+ group.shift(2*UP).to_edge(LEFT, buff = MED_LARGE_BUFF)
rect = BackgroundRectangle(group)
group.add_to_back(rect)
deriv.move_to(L, aligned_edge = RIGHT)
@@ -1132,8 +1132,8 @@ class FormalDefinitionOfLinear(LinearTransformationScene):
words.add_to_back(BackgroundRectangle(words))
# words.scale(0.8)
properties.add(words)
- properties.arrange_submobjects(DOWN, aligned_edge = LEFT, buff = MED_BUFF)
- properties.next_to(h_line, DOWN, buff = 2*MED_BUFF).to_edge(LEFT)
+ properties.arrange_submobjects(DOWN, aligned_edge = LEFT, buff = MED_SMALL_BUFF)
+ properties.next_to(h_line, DOWN, buff = MED_LARGE_BUFF).to_edge(LEFT)
self.play(Write(title), ShowCreation(h_line))
self.dither()
@@ -1442,7 +1442,7 @@ class PolynomialsHaveArbitrarilyLargeDegree(Scene):
"\\vdots"
]))
polys.gradient_highlight(BLUE_B, BLUE_D)
- polys.arrange_submobjects(DOWN, buff = 2*MED_BUFF)
+ polys.arrange_submobjects(DOWN, buff = MED_LARGE_BUFF)
polys.scale(1.3)
arrow = TexMobject("\\Rightarrow").scale(1.5)
@@ -1548,8 +1548,8 @@ class IntroducePolynomialSpace(Scene):
TexMobject("\\vdots"),
)
polys.gradient_highlight(BLUE_B, BLUE_D)
- polys.arrange_submobjects(DOWN, buff = MED_BUFF)
- polys.next_to(cloud.get_top(), DOWN, buff = 2*MED_BUFF)
+ polys.arrange_submobjects(DOWN, buff = MED_SMALL_BUFF)
+ polys.next_to(cloud.get_top(), DOWN, buff = MED_LARGE_BUFF)
self.play(ShowCreation(cloud))
for poly in polys:
@@ -1596,7 +1596,7 @@ class IntroducePolynomialSpace(Scene):
def list_basis_functions(self):
title = TextMobject("Basis functions")
- title.next_to(self.title, DOWN, buff = MED_BUFF)
+ title.next_to(self.title, DOWN, buff = MED_SMALL_BUFF)
title.to_edge(RIGHT)
h_line = Line(ORIGIN, RIGHT).scale(title.get_width())
h_line.next_to(title, DOWN)
@@ -1614,9 +1614,9 @@ class IntroducePolynomialSpace(Scene):
basis_group.target.arrange_submobjects(
DOWN, buff = 0.75*LARGE_BUFF, aligned_edge = LEFT
)
- basis_group.target.to_edge(RIGHT, buff = 2*MED_BUFF)
+ basis_group.target.to_edge(RIGHT, buff = MED_LARGE_BUFF)
dots = TexMobject("\\vdots")
- dots.next_to(basis_group.target, DOWN, buff = MED_BUFF, aligned_edge = LEFT)
+ dots.next_to(basis_group.target, DOWN, buff = MED_SMALL_BUFF, aligned_edge = LEFT)
basis_functions = [
TexMobject("b_%d(x)"%i, "=")
@@ -1682,7 +1682,7 @@ class IntroducePolynomialSpace(Scene):
]
for entry, term in zip(entries, terms+more_terms):
term.next_to(entry, LEFT, buff = LARGE_BUFF)
- more_terms[-1].shift(MED_BUFF*LEFT)
+ more_terms[-1].shift(MED_SMALL_BUFF*LEFT)
self.play(Transform(self.poly1, target))
self.dither()
@@ -1695,7 +1695,7 @@ class IntroducePolynomialSpace(Scene):
self.play(*map(FadeOut, [self.poly1]+more_terms))
self.poly2.next_to(equals, LEFT)
- self.poly2.shift(MED_BUFF*UP)
+ self.poly2.shift(MED_SMALL_BUFF*UP)
self.poly2.highlight(WHITE)
self.poly2[0].highlight(TEAL)
VGroup(*self.poly2[3:5]).highlight(Z_COLOR)
@@ -1767,7 +1767,7 @@ class IntroducePolynomialSpace(Scene):
deriv.generate_target()
deriv.target.next_to(
matrix.target, UP,
- buff = MED_BUFF,
+ buff = MED_SMALL_BUFF,
aligned_edge = LEFT
)
deriv.target.shift(0.25*RIGHT)
@@ -1897,7 +1897,7 @@ class MatrixVectorMultiplicationAndDerivative(TeacherStudentsScene):
arrow = TexMobject("\\Leftrightarrow")
deriv = TexMobject("\\dfrac{df}{dx}")
group = VGroup(mv_mult, arrow, deriv)
- group.arrange_submobjects(buff = MED_BUFF)
+ group.arrange_submobjects(buff = MED_SMALL_BUFF)
arrow.highlight(BLACK)
teacher = self.get_teacher()
@@ -1915,7 +1915,7 @@ class MatrixVectorMultiplicationAndDerivative(TeacherStudentsScene):
words = TextMobject("Linear transformations")
h_line = Line(ORIGIN, RIGHT).scale(words.get_width())
h_line.next_to(words, DOWN)
- group.target.next_to(h_line, DOWN, buff = MED_BUFF)
+ group.target.next_to(h_line, DOWN, buff = MED_SMALL_BUFF)
group.target[1].highlight(WHITE)
new_group = VGroup(words, h_line, group.target)
bubble.add_content(new_group)
@@ -1958,7 +1958,7 @@ class CompareTermsInLinearAlgebraToFunction(Scene):
"Eigenfunctions",
]))
for concepts, vect in (lin_alg_concepts, LEFT), (function_concepts, RIGHT):
- concepts.arrange_submobjects(DOWN, buff = 2*MED_BUFF, aligned_edge = LEFT)
+ concepts.arrange_submobjects(DOWN, buff = MED_LARGE_BUFF, aligned_edge = LEFT)
concepts.next_to(h_line, DOWN, buff = LARGE_BUFF)
concepts.shift(vect*SPACE_WIDTH/2)
concepts.gradient_highlight(YELLOW_B, YELLOW_C)
@@ -2041,7 +2041,7 @@ class YouAsAMathematician(Scene):
lhs = VGroup(eigen_equation, v_ne_zero)
lhs.arrange_submobjects(DOWN)
group = VGroup(lhs, arrow, det_equation)
- group.arrange_submobjects(buff = MED_BUFF)
+ group.arrange_submobjects(buff = MED_SMALL_BUFF)
return group
class ShowVectorSpaces(Scene):
@@ -2094,7 +2094,7 @@ class ShowVectorSpaces(Scene):
for x in range(3)
])
for subgroup in arrays:
- subgroup.arrange_submobjects(DOWN, buff = MED_BUFF)
+ subgroup.arrange_submobjects(DOWN, buff = MED_SMALL_BUFF)
arrays.arrange_submobjects(RIGHT)
arrays.scale(0.7)
arrays.gradient_highlight(YELLOW, MAROON_B)
@@ -2126,7 +2126,7 @@ class ToolsOfLinearAlgebra(Scene):
"Dot products",
"$\\vdots$"
]))
- words.arrange_submobjects(DOWN, aligned_edge = LEFT, buff = MED_BUFF)
+ words.arrange_submobjects(DOWN, aligned_edge = LEFT, buff = MED_SMALL_BUFF)
words[-1].next_to(words[-2], DOWN)
self.play(FadeIn(
words,
@@ -2240,11 +2240,11 @@ class ListAxioms(Scene):
for tex, color in tex_color_pairs:
axiom.highlight_by_tex(tex, color)
axioms.arrange_submobjects(
- DOWN, buff = 2*MED_BUFF,
+ DOWN, buff = MED_LARGE_BUFF,
aligned_edge = LEFT
)
axioms.scale_to_fit_width(2*SPACE_WIDTH-1)
- axioms.next_to(h_line, DOWN, buff = MED_BUFF)
+ axioms.next_to(h_line, DOWN, buff = MED_SMALL_BUFF)
self.play(FadeIn(
axioms,
@@ -2387,7 +2387,7 @@ class VectorSpaceOfPiCreatures(Scene):
scale_equation.arrange_submobjects()
VGroup(sum_equation, scale_equation).arrange_submobjects(
- DOWN, buff = MED_BUFF
+ DOWN, buff = MED_SMALL_BUFF
)
self.play(FadeOut(creatures))
@@ -2515,8 +2515,8 @@ class WhatIsThree(Scene):
group.gradient_highlight(YELLOW, MAROON_B)
else:
m1, m2, m3 = group
- m2.next_to(m1, buff = MED_BUFF)
- m3.next_to(VGroup(m1, m2), DOWN, buff = MED_BUFF)
+ m2.next_to(m1, buff = MED_SMALL_BUFF)
+ m3.next_to(VGroup(m1, m2), DOWN, buff = MED_SMALL_BUFF)
group.next_to(three, vect, buff = LARGE_BUFF)
self.play(FadeIn(group))
self.dither()
diff --git a/old_projects/eola/chapter7.py b/old_projects/eola/chapter7.py
index 29dc51dd0..4793a3694 100644
--- a/old_projects/eola/chapter7.py
+++ b/old_projects/eola/chapter7.py
@@ -180,7 +180,7 @@ class ShowNumericalDotProduct(Scene):
v2 = Matrix(self.v2)
inter_array_dot = TexMobject("\\cdot").scale(1.5)
dot_product = VGroup(v1, inter_array_dot, v2)
- dot_product.arrange_submobjects(RIGHT, buff = MED_BUFF/2)
+ dot_product.arrange_submobjects(RIGHT, buff = MED_SMALL_BUFF/2)
dot_product.to_edge(LEFT)
pairs = zip(v1.get_entries(), v2.get_entries())
@@ -459,7 +459,7 @@ class ShowQualitativeDotProductValues(VectorScene):
])
for word, sym in zip(words, [comp, equals, less_than]):
word.add_background_rectangle()
- word.next_to(sym, DOWN, aligned_edge = LEFT, buff = MED_BUFF)
+ word.next_to(sym, DOWN, aligned_edge = LEFT, buff = MED_SMALL_BUFF)
word.highlight(sym.get_color())
v = Vector([1.5, 1.5], color = V_COLOR)
@@ -713,7 +713,7 @@ class TwoDToOneDScene(LinearTransformationScene):
class Introduce2Dto1DLinearTransformations(TwoDToOneDScene):
def construct(self):
number_line_words = TextMobject("Number line")
- number_line_words.next_to(self.number_line, UP, buff = MED_BUFF)
+ number_line_words.next_to(self.number_line, UP, buff = MED_SMALL_BUFF)
numbers = VMobject(*self.number_line.get_number_mobjects())
self.remove(self.number_line)
@@ -810,8 +810,8 @@ class OkayToIgnoreFormalProperties(Scene):
tex_mob.highlight_by_tex(v_tex, V_COLOR)
tex_mob.highlight_by_tex(w_tex, W_COLOR)
tex_mob.highlight_by_tex("c", GREEN)
- additivity.next_to(h_line, DOWN, buff = MED_BUFF)
- scaling.next_to(additivity, DOWN, buff = MED_BUFF)
+ additivity.next_to(h_line, DOWN, buff = MED_SMALL_BUFF)
+ scaling.next_to(additivity, DOWN, buff = MED_SMALL_BUFF)
words = TextMobject("We'll ignore these")
words.highlight(RED)
arrow = Arrow(DOWN, UP, color = RED)
@@ -869,11 +869,11 @@ class FormalVsVisual(Scene):
visual_statement.submobject_gradient_highlight(YELLOW, MAROON_B)
properties = VMobject(additivity, scaling)
- properties.arrange_submobjects(DOWN, buff = MED_BUFF)
+ properties.arrange_submobjects(DOWN, buff = MED_SMALL_BUFF)
for text, mob in (formal, properties), (visual, visual_statement):
mob.scale(0.75)
- mob.next_to(text, DOWN, buff = MED_BUFF)
+ mob.next_to(text, DOWN, buff = MED_SMALL_BUFF)
self.add(title)
self.play(*map(ShowCreation, [line, v_line]))
@@ -1029,7 +1029,7 @@ class NonLinearFailsDotTest(TwoDTo1DTransformWithDots):
"Line of dots", "do not", "remain evenly spaced"
)
words.highlight_by_tex("do not", RED)
- words.next_to(line, UP, buff = MED_BUFF)
+ words.next_to(line, UP, buff = MED_SMALL_BUFF)
array_tex = matrix_to_tex_string(["x", "y"])
equation = TexMobject(
"f", "\\left(%s \\right)"%array_tex, " = x^2 - y^2"
@@ -1306,7 +1306,7 @@ class AssociationBetweenMatricesAndVectors(Scene):
arrow = DoubleArrow(LEFT, RIGHT, color = WHITE)
VGroup(
matrices_words, arrow, vectors_words
- ).arrange_submobjects(buff = MED_BUFF)
+ ).arrange_submobjects(buff = MED_SMALL_BUFF)
matrices = VGroup(*map(Matrix, self.matrices))
vectors = VGroup(*map(Matrix, [m[0] for m in self.matrices]))
@@ -1318,7 +1318,7 @@ class AssociationBetweenMatricesAndVectors(Scene):
vectors.words = vectors_words
for group in matrices, vectors:
for m, direction in zip(group, [UP, DOWN]):
- m.next_to(group.words, direction, buff = MED_BUFF)
+ m.next_to(group.words, direction, buff = MED_SMALL_BUFF)
self.play(*map(Write, [matrices_words, vectors_words]))
self.play(ShowCreation(arrow))
@@ -1597,7 +1597,7 @@ class ProjectSingleVectorOnUHat(ProjectOntoUnitVectorNumberline):
dot_product = TexMobject(v_tex, "\\cdot", u_tex)
dot_product.highlight_by_tex(v_tex, v.get_color())
dot_product.highlight_by_tex(u_tex, self.u_hat.get_color())
- dot_product.next_to(ORIGIN, UP, buff = MED_BUFF)
+ dot_product.next_to(ORIGIN, UP, buff = MED_SMALL_BUFF)
dot_product.rotate(self.tilt_angle)
dot_product.shift(v.proj.get_end())
dot_product.add_background_rectangle()
@@ -1626,7 +1626,7 @@ class AskAboutProjectionMatrix(Scene):
matrix = Matrix([["?", "?"]])
matrix.highlight_columns(X_COLOR, Y_COLOR)
words = TextMobject("Projection matrix:")
- VMobject(words, matrix).arrange_submobjects(buff = MED_BUFF).shift(UP)
+ VMobject(words, matrix).arrange_submobjects(buff = MED_SMALL_BUFF).shift(UP)
basis_words = [
TextMobject("Where", "$\\hat{\\%smath}$"%char, "lands")
for char in "i", "j"
@@ -1679,7 +1679,7 @@ class ProjectBasisVectors(ProjectOntoUnitVectorNumberline):
question.add_background_rectangle()
matrix = Matrix([["u_x", "u_y"]])
VGroup(question, matrix).arrange_submobjects(DOWN).to_corner(
- UP+LEFT, buff = MED_BUFF/2
+ UP+LEFT, buff = MED_SMALL_BUFF/2
)
matrix_rect = BackgroundRectangle(matrix)
@@ -1695,7 +1695,7 @@ class ProjectBasisVectors(ProjectOntoUnitVectorNumberline):
for label, vect, direction in trips:
label.highlight(vect.get_color())
label.scale(1.2)
- label.next_to(vect.get_end(), direction, buff = MED_BUFF/2)
+ label.next_to(vect.get_end(), direction, buff = MED_SMALL_BUFF/2)
self.play(Write(u_label, run_time = 1))
self.play(*map(ShowCreation, basis_vectors))
@@ -2094,8 +2094,8 @@ class TwoDOneDTransformationSeparateSpace(Scene):
for words in start_words, end_words:
words.add_background_rectangle()
words.scale(0.8)
- start_words.next_to(ORIGIN, RIGHT, buff = MED_BUFF).to_edge(UP)
- end_words.next_to(ORIGIN, DOWN+LEFT, buff = MED_BUFF/2)
+ start_words.next_to(ORIGIN, RIGHT, buff = MED_SMALL_BUFF).to_edge(UP)
+ end_words.next_to(ORIGIN, DOWN+LEFT, buff = MED_SMALL_BUFF/2)
self.play(*map(ShowCreation, [
plane, number_line, v_line
@@ -2154,7 +2154,7 @@ class LooseDualityDescription(Scene):
arrow = TexMobject("\\Leftrightarrow")
words = TextMobject("Natural-but-surprising", "correspondence")
words[1].gradient_highlight(BLUE, YELLOW)
- VGroup(duality, arrow, words).arrange_submobjects(buff = MED_BUFF)
+ VGroup(duality, arrow, words).arrange_submobjects(buff = MED_SMALL_BUFF)
self.add(duality)
self.play(Write(arrow))
@@ -2277,7 +2277,7 @@ class WhatTheVectorWantsToBe(Scene):
"to be"
)
words[1].highlight(BLUE)
- words.next_to(matrix, UP, buff = MED_BUFF)
+ words.next_to(matrix, UP, buff = MED_SMALL_BUFF)
self.add(plane, v_line, number_line, numbers)
self.play(ShowCreation(vect))
@@ -2306,7 +2306,7 @@ class NextVideo(Scene):
light of linear transformations
""")
title.scale_to_fit_height(1.2)
- title.to_edge(UP, buff = MED_BUFF/2)
+ title.to_edge(UP, buff = MED_SMALL_BUFF/2)
rect = Rectangle(width = 16, height = 9, color = BLUE)
rect.scale_to_fit_height(6)
rect.next_to(title, DOWN)
diff --git a/old_projects/eola/chapter8.py b/old_projects/eola/chapter8.py
index 599db5e5d..45ddcea49 100644
--- a/old_projects/eola/chapter8.py
+++ b/old_projects/eola/chapter8.py
@@ -185,10 +185,10 @@ class SimpleDefine2dCrossProduct(LinearTransformationScene):
cross_rect = BackgroundRectangle(cross)
equals = TexMobject("=")
equals.add_background_rectangle()
- equals.next_to(cross, buff = MED_BUFF/2)
+ equals.next_to(cross, buff = MED_SMALL_BUFF/2)
words = TextMobject("Area of parallelogram")
words.add_background_rectangle()
- words.next_to(equals, buff = MED_BUFF/2)
+ words.next_to(equals, buff = MED_SMALL_BUFF/2)
arrow = Arrow(
words.get_bottom(),
self.square.get_center(),
@@ -491,7 +491,7 @@ class ContrastDotAndCross(Scene):
dot_prod.arrange_submobjects(RIGHT)
if dot_prod.get_width() > max_width:
dot_prod.scale_to_fit_width(max_width)
- dot_prod.next_to(last_mob, DOWN, buff = MED_BUFF)
+ dot_prod.next_to(last_mob, DOWN, buff = MED_SMALL_BUFF)
last_mob = dot_prod
dot_prod.to_edge(LEFT)
dot_prod.remove(result)
@@ -561,7 +561,7 @@ class ContrastDotAndCross(Scene):
)
full_cross_product.arrange_submobjects()
full_cross_product.scale(0.75)
- full_cross_product.next_to(self.r_h_line, DOWN, buff = MED_BUFF/2)
+ full_cross_product.next_to(self.r_h_line, DOWN, buff = MED_SMALL_BUFF/2)
full_cross_product.remove(result)
self.play(
Write(full_cross_product),
@@ -593,7 +593,7 @@ class ContrastDotAndCross(Scene):
def add_2d_cross_product(self):
h_line = DashedLine(ORIGIN, SPACE_WIDTH*RIGHT)
- h_line.next_to(self.only_3d_text, DOWN, buff = MED_BUFF/2)
+ h_line.next_to(self.only_3d_text, DOWN, buff = MED_SMALL_BUFF/2)
h_line.to_edge(RIGHT, buff = 0)
arrays = np.random.randint(0, 9, (2, 2))
m1, m2 = matrices = map(Matrix, arrays)
@@ -616,7 +616,7 @@ class ContrastDotAndCross(Scene):
result.arrange_submobjects(RIGHT)
full_cross_product = VGroup(cross_product, result)
full_cross_product.arrange_submobjects(RIGHT)
- full_cross_product.next_to(h_line, DOWN, buff = MED_BUFF/2)
+ full_cross_product.next_to(h_line, DOWN, buff = MED_SMALL_BUFF/2)
self.play(ShowCreation(h_line))
self.play(Write(cross_product))
@@ -1111,7 +1111,7 @@ class TwoDCrossProductExample(Define2dCrossProduct):
self.show_transformation(v, w)
det_sym = TexMobject(str(int(abs(det))))
det_sym.scale(1.5)
- det_sym.next_to(v.get_end()+w.get_end(), DOWN+RIGHT, buff = MED_BUFF/2)
+ det_sym.next_to(v.get_end()+w.get_end(), DOWN+RIGHT, buff = MED_SMALL_BUFF/2)
arc = self.get_arc(v, w, radius = 1)
arc.highlight(RED)
self.play(Write(det_sym))
@@ -1169,7 +1169,7 @@ class BiggerWhenPerpendicular(LinearTransformationScene):
group.arrange_submobjects()
group.to_edge(UP)
end_words.move_to(start_words, aligned_edge = RIGHT)
- smaller.next_to(cross_is, buff = MED_BUFF/2, aligned_edge = DOWN)
+ smaller.next_to(cross_is, buff = MED_SMALL_BUFF/2, aligned_edge = DOWN)
for mob in list(group) + [end_words, smaller]:
mob.add_background_rectangle()
@@ -1593,11 +1593,11 @@ class DeterminantTrick(Scene):
if last_mob:
plus = TexMobject("+")
syms.add(plus)
- plus.next_to(term, LEFT, buff = MED_BUFF/2)
+ plus.next_to(term, LEFT, buff = MED_SMALL_BUFF/2)
term.add_to_back(plus)
- term.next_to(last_mob, RIGHT, buff = MED_BUFF/2)
+ term.next_to(last_mob, RIGHT, buff = MED_SMALL_BUFF/2)
else:
- term.next_to(equation, DOWN, buff = MED_BUFF, aligned_edge = LEFT)
+ term.next_to(equation, DOWN, buff = MED_SMALL_BUFF, aligned_edge = LEFT)
last_mob = term
self.play(*it.chain(*[
[mob.scale_in_place, 1.2]
@@ -1659,7 +1659,7 @@ class NextVideo(Scene):
light of linear transformations
""")
title.scale_to_fit_height(1.2)
- title.to_edge(UP, buff = MED_BUFF/2)
+ title.to_edge(UP, buff = MED_SMALL_BUFF/2)
rect = Rectangle(width = 16, height = 9, color = BLUE)
rect.scale_to_fit_height(6)
rect.next_to(title, DOWN)
@@ -1700,10 +1700,10 @@ class CrossAndDualWords(Scene):
VGroup(transform, dot_with_cross).scale(0.7)
VGroup(vector_word, cross).arrange_submobjects(
- RIGHT, buff = MED_BUFF
+ RIGHT, buff = MED_SMALL_BUFF
).center().shift(LEFT).to_edge(UP)
- transform_word.next_to(vector_word, DOWN, buff = MED_BUFF, aligned_edge = LEFT)
- transform.next_to(transform_word, DOWN, buff = MED_BUFF, aligned_edge = LEFT)
+ transform_word.next_to(vector_word, DOWN, buff = MED_SMALL_BUFF, aligned_edge = LEFT)
+ transform.next_to(transform_word, DOWN, buff = MED_SMALL_BUFF, aligned_edge = LEFT)
dot_with_cross.next_to(func, RIGHT)
self.add(vector_word)
diff --git a/old_projects/eola/chapter8p2.py b/old_projects/eola/chapter8p2.py
index acdff279e..643c0e7fc 100644
--- a/old_projects/eola/chapter8p2.py
+++ b/old_projects/eola/chapter8p2.py
@@ -104,9 +104,9 @@ class BruteForceVerification(Scene):
computation_words.scale(0.75)
h_line = Line(LEFT, RIGHT).scale(SPACE_WIDTH)
v_line = Line(UP, DOWN).scale(SPACE_HEIGHT)
- computation_words.to_edge(UP, buff = MED_BUFF/2)
+ computation_words.to_edge(UP, buff = MED_SMALL_BUFF/2)
h_line.next_to(computation_words, DOWN)
- formula_word.next_to(h_line, UP, buff = MED_BUFF)
+ formula_word.next_to(h_line, UP, buff = MED_SMALL_BUFF)
computation_words.shift(SPACE_WIDTH*RIGHT/2)
formula_word.shift(SPACE_WIDTH*LEFT/2)
@@ -146,7 +146,7 @@ class BruteForceVerification(Scene):
mob.highlight_by_tex(v_tex, V_COLOR)
mob.highlight_by_tex(w_tex, W_COLOR)
mob.highlight_by_tex("\\theta", GREEN)
- mob.next_to(last_point, DOWN, buff = MED_BUFF)
+ mob.next_to(last_point, DOWN, buff = MED_SMALL_BUFF)
if mob.get_width() > max_width:
mob.scale_to_fit_width(max_width)
last_point = mob
@@ -276,7 +276,7 @@ class MathematicalWild(Scene):
to the number line
""")
bubble.content.highlight(BLUE)
- bubble.content.shift(MED_BUFF*UP/2)
+ bubble.content.shift(MED_SMALL_BUFF*UP/2)
bubble.remove(*bubble[:-1])
bubble.add(bubble.content)
bubble.next_to(randy.get_corner(UP+RIGHT), RIGHT)
@@ -334,7 +334,7 @@ class ThreeStepPlan(Scene):
steps[2].highlight_by_tex(cross_text, P_COLOR)
VGroup(*steps).arrange_submobjects(
DOWN, aligned_edge = LEFT, buff = LARGE_BUFF
- ).next_to(h_line, DOWN, buff = MED_BUFF)
+ ).next_to(h_line, DOWN, buff = MED_SMALL_BUFF)
self.add(title)
self.play(ShowCreation(h_line))
@@ -343,7 +343,7 @@ class ThreeStepPlan(Scene):
self.dither()
linear_transformation = TextMobject("Linear", "transformation")
- linear_transformation.next_to(h_line, DOWN, MED_BUFF)
+ linear_transformation.next_to(h_line, DOWN, MED_SMALL_BUFF)
det = self.get_det()
rect = Rectangle(width = 16, height = 9, color = BLUE)
rect.scale_to_fit_height(3.5)
@@ -418,7 +418,7 @@ class DefineDualTransform(Scene):
definition.arrange_submobjects(RIGHT)
definitions.add(definition)
defs_equals.add(equals)
- definitions.arrange_submobjects(buff = MED_BUFF)
+ definitions.arrange_submobjects(buff = MED_SMALL_BUFF)
definitions.shift(2*DOWN)
mobs_with_targets = list(it.chain(
@@ -442,7 +442,7 @@ class DefineDualTransform(Scene):
final_mobs = VGroup(triple_cross, VGroup(det_text, matrix))
final_mobs.arrange_submobjects()
- final_mobs.next_to(self.title, DOWN, buff = MED_BUFF)
+ final_mobs.next_to(self.title, DOWN, buff = MED_SMALL_BUFF)
for mob in definitions, final_mobs:
mob.scale_to_fit_width(SPACE_WIDTH - 1)
@@ -720,7 +720,7 @@ class DefineDualTransform(Scene):
component.arrange_submobjects()
cross_components.add(component)
to_fade.add(syms[0], syms[-1], quint[0])
- cross_components.arrange_submobjects(DOWN, aligned_edge = LEFT, buff = MED_BUFF)
+ cross_components.arrange_submobjects(DOWN, aligned_edge = LEFT, buff = MED_SMALL_BUFF)
cross_components.next_to(dot_components, RIGHT)
for quint in quints:
self.play(*[
@@ -739,7 +739,7 @@ class DefineDualTransform(Scene):
self.play(
ApplyFunction(
lambda m : m.arrange_submobjects(
- DOWN, buff = MED_BUFF+SMALL_BUFF
+ DOWN, buff = MED_SMALL_BUFF+SMALL_BUFF
).next_to(cross_components, LEFT),
new_ps
),
@@ -773,7 +773,7 @@ class DefineDualTransform(Scene):
question.highlight_by_tex(p_tex, P_COLOR)
everything.target = everything.copy()
everything.target.next_to(
- question, DOWN, buff = MED_BUFF
+ question, DOWN, buff = MED_SMALL_BUFF
)
self.play(
MoveToTarget(everything),
@@ -829,7 +829,7 @@ class DotProductWords(Scene):
p_mob.highlight(P_COLOR)
input_array = Matrix(list("xyz"))
dot_product = VGroup(p_mob, Dot(radius = 0.07), input_array)
- dot_product.arrange_submobjects(buff = MED_BUFF/2)
+ dot_product.arrange_submobjects(buff = MED_SMALL_BUFF/2)
equals = TexMobject("=")
dot_product.next_to(equals, LEFT)
words = VGroup(*it.starmap(TextMobject, [
@@ -909,7 +909,7 @@ class NextVideo(Scene):
title = TextMobject("""
Next video: Change of basis
""")
- title.to_edge(UP, buff = MED_BUFF/2)
+ title.to_edge(UP, buff = MED_SMALL_BUFF/2)
rect = Rectangle(width = 16, height = 9, color = BLUE)
rect.scale_to_fit_height(6)
rect.next_to(title, DOWN)
diff --git a/old_projects/eola/chapter9.py b/old_projects/eola/chapter9.py
index fb0eedd44..95429d6c6 100644
--- a/old_projects/eola/chapter9.py
+++ b/old_projects/eola/chapter9.py
@@ -49,7 +49,7 @@ def get_small_bubble(pi_creature, height = 4, width = 3):
bubble.stretch_to_fit_height(height)
if pi_center_x < 0:
bubble.flip()
- bubble.next_to(pi_creature, UP, buff = MED_BUFF)
+ bubble.next_to(pi_creature, UP, buff = MED_SMALL_BUFF)
bubble.shift_onto_screen()
bubble.set_fill(BLACK, opacity = 0.8)
return bubble
@@ -241,16 +241,16 @@ class RemindOfCoordinates(LinearCombinationScene):
ass1 = TextMobject("-First coordinate")
ass1 = VGroup(ass1, self.i_hat.copy())
- ass1.arrange_submobjects(buff = MED_BUFF)
+ ass1.arrange_submobjects(buff = MED_SMALL_BUFF)
ass2 = TextMobject("-Second coordinate")
ass2 = VGroup(ass2, self.j_hat.copy())
- ass2.arrange_submobjects(buff = MED_BUFF)
+ ass2.arrange_submobjects(buff = MED_SMALL_BUFF)
ass3 = TextMobject("-Unit of distance")
group = VGroup(title, ass1, ass2, ass3)
- group.arrange_submobjects(DOWN, aligned_edge = LEFT, buff = MED_BUFF)
+ group.arrange_submobjects(DOWN, aligned_edge = LEFT, buff = MED_SMALL_BUFF)
group.to_corner(UP+LEFT)
# VGroup(*group[1:]).shift(0.5*DOWN)
for words in group:
@@ -295,7 +295,7 @@ class NameCoordinateSystem(Scene):
coords = Matrix([3, 2])
arrow = TexMobject("\\Rightarrow")
vector.next_to(arrow, RIGHT, buff = 0)
- coords.next_to(arrow, LEFT, buff = 2*MED_BUFF)
+ coords.next_to(arrow, LEFT, buff = MED_LARGE_BUFF)
group = VGroup(coords, arrow, vector)
group.shift(2*UP)
coordinate_system = TextMobject("``Coordinate system''")
@@ -313,7 +313,7 @@ class NameCoordinateSystem(Scene):
basis_group = VGroup(i_hat, j_hat, i_label, j_label)
basis_group.shift(DOWN)
basis_words = TextMobject("``Basis vectors''")
- basis_words.shift(basis_group.get_bottom()[1]*UP+MED_BUFF*DOWN)
+ basis_words.shift(basis_group.get_bottom()[1]*UP+MED_SMALL_BUFF*DOWN)
self.play(Write(coords))
self.play(Write(arrow), ShowCreation(vector))
@@ -653,11 +653,11 @@ class SpeakingDifferentLanguages(JenniferScene):
for pi in jenny, you:
pi.bubble = pi.get_bubble("speech", width = 4.5, height = 3.5)
if pi is you:
- pi.bubble.shift(MED_BUFF*RIGHT)
+ pi.bubble.shift(MED_SMALL_BUFF*RIGHT)
else:
pi.coords.scale(0.8)
- pi.bubble.shift(MED_BUFF*LEFT)
- pi.coords.next_to(pi.text, buff = MED_BUFF)
+ pi.bubble.shift(MED_SMALL_BUFF*LEFT)
+ pi.coords.next_to(pi.text, buff = MED_SMALL_BUFF)
pi.coords.add(pi.text)
pi.bubble.add_content(pi.coords)
@@ -980,7 +980,7 @@ class TalkThroughChangeOfBasisMatrix(JenniferScene):
matrix = Matrix(np.array([self.b1_coords, self.b2_coords]).T)
matrix.highlight_columns(X_COLOR, Y_COLOR)
- matrix.next_to(ORIGIN, RIGHT, buff = MED_BUFF).to_edge(UP)
+ matrix.next_to(ORIGIN, RIGHT, buff = MED_SMALL_BUFF).to_edge(UP)
b1_coords = Matrix(self.b1_coords)
b1_coords.highlight(X_COLOR)
@@ -1103,7 +1103,7 @@ class ChangeOfBasisExample(JenniferScene):
start_words = TextMobject("How", "we", "think of")
start_words.add_background_rectangle()
start_group = VGroup(start_words, v_coords)
- start_group.arrange_submobjects(buff = MED_BUFF)
+ start_group.arrange_submobjects(buff = MED_SMALL_BUFF)
start_group.next_to(self.you, LEFT, buff = 0)
start_group.to_edge(UP)
end_words = TextMobject("How", "Jennifer", "thinks of")
@@ -1178,7 +1178,7 @@ class FeelsBackwards(Scene):
##Swap things
inverse_word = TextMobject("Inverse")
- inverse_word.next_to(matrix, LEFT, buff = MED_BUFF)
+ inverse_word.next_to(matrix, LEFT, buff = MED_SMALL_BUFF)
inverse_exponent = TexMobject("-1")
inverse_exponent.next_to(matrix.get_corner(UP+RIGHT), RIGHT)
self.play(*map(Write, [inverse_word, inverse_exponent]))
@@ -1209,8 +1209,8 @@ class RecallInverse(JenniferScene):
matrix = Matrix(numerical_t_matrix.T)
matrix.add_to_back(BackgroundRectangle(matrix))
matrix.highlight_columns(X_COLOR, Y_COLOR)
- matrix.to_corner(UP+LEFT, buff = 2*MED_BUFF)
- # matrix.shift(MED_BUFF*DOWN)
+ matrix.to_corner(UP+LEFT, buff = MED_LARGE_BUFF)
+ # matrix.shift(MED_SMALL_BUFF*DOWN)
inverse_exponent = TexMobject("-1")
inverse_exponent.next_to(matrix.get_corner(UP+RIGHT), RIGHT)
inverse_exponent.add_background_rectangle()
@@ -1227,7 +1227,7 @@ class RecallInverse(JenniferScene):
inv_matrix.scale_to_fit_height(matrix.get_height())
inv_matrix.add_to_back(BackgroundRectangle(inv_matrix))
equals.next_to(matrix, RIGHT, buff = 0.7)
- inv_matrix.next_to(equals, RIGHT, buff = MED_BUFF)
+ inv_matrix.next_to(equals, RIGHT, buff = MED_SMALL_BUFF)
self.add_foreground_mobject(matrix)
self.apply_transposed_matrix(numerical_t_matrix)
@@ -1417,7 +1417,7 @@ class SummarizeTranslationProcess(Scene):
self.play(
VGroup(her_vector, equals).next_to, A_inv, LEFT,
her_arrow.rotate_in_place, -np.pi/6,
- her_arrow.shift, MED_BUFF*LEFT,
+ her_arrow.shift, MED_SMALL_BUFF*LEFT,
Transform(A, A_inv, path_arc = np.pi)
)
self.dither()
@@ -1447,9 +1447,9 @@ class Prerequisites(Scene):
for direction, words in zip([LEFT, RIGHT], prereqs):
rect = Rectangle(height = 9, width = 16)
rect.scale_to_fit_height(3.5)
- rect.next_to(ORIGIN, direction, buff = MED_BUFF)
+ rect.next_to(ORIGIN, direction, buff = MED_SMALL_BUFF)
rect.highlight(BLUE)
- words.next_to(rect, UP, buff = MED_BUFF)
+ words.next_to(rect, UP, buff = MED_SMALL_BUFF)
self.play(
Write(words),
ShowCreation(rect)
@@ -1493,7 +1493,7 @@ class RotationExample(LinearTransformationScene):
coords.add_to_back(coords.rect)
coords.highlight(vect.get_color())
direction = UP if vect is self.j_hat else RIGHT
- coords.next_to(vect.get_end(), direction, buff = MED_BUFF)
+ coords.next_to(vect.get_end(), direction, buff = MED_SMALL_BUFF)
self.play(Write(coords))
self.dither()
@@ -1525,7 +1525,7 @@ class RotationExample(LinearTransformationScene):
follow_basis.add_background_rectangle()
follow_basis.next_to(
matrix, LEFT,
- buff = MED_BUFF,
+ buff = MED_SMALL_BUFF,
)
record = TextMobject(
@@ -1536,7 +1536,7 @@ class RotationExample(LinearTransformationScene):
record.add_background_rectangle()
record.next_to(
matrix, DOWN,
- buff = MED_BUFF,
+ buff = MED_SMALL_BUFF,
aligned_edge = LEFT
)
@@ -1813,7 +1813,7 @@ class NextVideo(Scene):
title = TextMobject("""
Next video: Eigenvectors and eigenvalues
""")
- title.to_edge(UP, buff = MED_BUFF)
+ title.to_edge(UP, buff = MED_SMALL_BUFF)
rect = Rectangle(width = 16, height = 9, color = BLUE)
rect.scale_to_fit_height(6)
rect.next_to(title, DOWN)
diff --git a/old_projects/eola/footnote2.py b/old_projects/eola/footnote2.py
index b7c1ed419..84adffef2 100644
--- a/old_projects/eola/footnote2.py
+++ b/old_projects/eola/footnote2.py
@@ -285,7 +285,7 @@ class MatrixInTheWild(Scene):
matrix.next_to(randy, RIGHT, buff = LARGE_BUFF, aligned_edge = DOWN)
bubble = randy.get_bubble(height = 4)
bubble.make_green_screen()
- VMobject(randy, bubble, matrix).to_corner(UP+LEFT, buff = MED_BUFF)
+ VMobject(randy, bubble, matrix).to_corner(UP+LEFT, buff = MED_SMALL_BUFF)
self.add(randy)
self.play(Write(matrix))
@@ -449,7 +449,7 @@ class TwoDTo1DTransform(LinearTransformationScene):
def construct(self):
line = NumberLine()
plane_words = TextMobject("2d space")
- plane_words.next_to(self.j_hat, UP, buff = MED_BUFF)
+ plane_words.next_to(self.j_hat, UP, buff = MED_SMALL_BUFF)
plane_words.add_background_rectangle()
line_words = TextMobject("1d space (number line)")
line_words.next_to(line, UP)
@@ -483,7 +483,7 @@ class TwoDTo1DTransform(LinearTransformationScene):
matrix = Matrix([[1, 2]])
matrix_words = TextMobject("Transformation matrix: ")
matrix_group = VMobject(matrix_words, matrix)
- matrix_group.arrange_submobjects(buff = MED_BUFF)
+ matrix_group.arrange_submobjects(buff = MED_SMALL_BUFF)
matrix_group.to_edge(UP)
entries = matrix.get_entries()
@@ -518,7 +518,7 @@ class TwoDTo1DTransformWithDots(TwoDTo1DTransform):
words = TextMobject(
"Line of dots remains evenly spaced"
)
- words.next_to(line, UP, buff = MED_BUFF)
+ words.next_to(line, UP, buff = MED_SMALL_BUFF)
self.play(Write(dots))
self.apply_transposed_matrix(
diff --git a/old_projects/eola/thumbnails.py b/old_projects/eola/thumbnails.py
index cf708827c..1e6dca56a 100644
--- a/old_projects/eola/thumbnails.py
+++ b/old_projects/eola/thumbnails.py
@@ -104,10 +104,10 @@ class Chapter9(Scene):
for pi in jenny, you:
pi.bubble = pi.get_bubble("speech", width = 3, height = 3)
if pi is you:
- pi.bubble.shift(MED_BUFF*RIGHT)
+ pi.bubble.shift(MED_SMALL_BUFF*RIGHT)
else:
pi.coords.scale(0.8)
- pi.bubble.shift(MED_BUFF*LEFT)
+ pi.bubble.shift(MED_SMALL_BUFF*LEFT)
pi.bubble.add_content(pi.coords)
pi.add(pi.bubble, pi.coords)
pi.look_at(vector)
diff --git a/old_projects/hanoi.py b/old_projects/hanoi.py
index 98f235145..ec8cb076e 100644
--- a/old_projects/hanoi.py
+++ b/old_projects/hanoi.py
@@ -2268,7 +2268,7 @@ class RecursiveSolutionToConstrained(RecursiveSolution):
smaller_subdivision.set_fill(opacity = 0)
self.play(
steps.shift,
- (SPACE_HEIGHT-sub_sub_steps.get_top()[1]-MED_BUFF)*UP,
+ (SPACE_HEIGHT-sub_sub_steps.get_top()[1]-MED_SMALL_BUFF)*UP,
self.eyes.look_at_anim(steps)
)
self.play(ApplyMethod(
diff --git a/old_projects/patreon.py b/old_projects/patreon.py
index 4658c13f6..4c50d8be3 100644
--- a/old_projects/patreon.py
+++ b/old_projects/patreon.py
@@ -161,7 +161,7 @@ class GrowingToDoList(Scene):
"Understanding entropy",
]))
lines.scale(0.65)
- lines.arrange_submobjects(DOWN, buff = MED_BUFF, aligned_edge = LEFT)
+ lines.arrange_submobjects(DOWN, buff = MED_SMALL_BUFF, aligned_edge = LEFT)
lines.gradient_highlight(BLUE_C, YELLOW)
lines.next_to(title, DOWN, buff = LARGE_BUFF/2.)
lines.to_edge(RIGHT)
@@ -213,9 +213,9 @@ class TwoTypesOfVideos(Scene):
"ODEs",
]
])
- series_list.arrange_submobjects(DOWN, aligned_edge = LEFT, buff = MED_BUFF)
+ series_list.arrange_submobjects(DOWN, aligned_edge = LEFT, buff = MED_SMALL_BUFF)
series_list.scale_to_fit_width(SPACE_WIDTH-2)
- series_list.next_to(series, DOWN, buff = MED_BUFF)
+ series_list.next_to(series, DOWN, buff = MED_SMALL_BUFF)
series_list.to_edge(RIGHT)
fridays = TextMobject("Every other friday")
@@ -224,14 +224,14 @@ class TwoTypesOfVideos(Scene):
words.highlight(YELLOW)
words.next_to(
morty, vect,
- buff = MED_BUFF,
+ buff = MED_SMALL_BUFF,
aligned_edge = UP
)
unless = TextMobject("""
Unless you're
a patron \\dots
""")
- unless.next_to(when_done, DOWN, buff = MED_BUFF)
+ unless.next_to(when_done, DOWN, buff = MED_SMALL_BUFF)
self.add(morty)
self.play(Blink(morty))
@@ -451,8 +451,8 @@ class PythagoreanTransformation(Scene):
tri1.copy().rotate(-i*np.pi/2)
for i in range(1, 4)
]
- a = TexMobject("a").next_to(tri1[0], DOWN, buff = MED_BUFF)
- b = TexMobject("b").next_to(tri1[2], LEFT, buff = MED_BUFF)
+ a = TexMobject("a").next_to(tri1[0], DOWN, buff = MED_SMALL_BUFF)
+ b = TexMobject("b").next_to(tri1[2], LEFT, buff = MED_SMALL_BUFF)
c = TexMobject("c").next_to(tri1[1].get_center(), UP+RIGHT)
c_square = Polygon(*[
@@ -547,9 +547,9 @@ class MakeALotOfPiCreaturesHappy(Scene):
VGroup(*[
Randolph()
for x in range(7)
- ]).arrange_submobjects(RIGHT, buff = 2*MED_BUFF)
+ ]).arrange_submobjects(RIGHT, buff = MED_LARGE_BUFF)
for x in range(4)
- ]).arrange_submobjects(DOWN, buff = 2*MED_BUFF)
+ ]).arrange_submobjects(DOWN, buff = MED_LARGE_BUFF)
pi_list = list(it.chain(*[
layer.submobjects
diff --git a/old_projects/tattoo.py b/old_projects/tattoo.py
index ea1d11154..1e286718f 100644
--- a/old_projects/tattoo.py
+++ b/old_projects/tattoo.py
@@ -709,7 +709,7 @@ class ExplainTrigFunctionDistances(TrigRepresentationsScene, PiCreatureScene):
text.scale(0.75)
text[-2].highlight(self.theta_color)
text.add_background_rectangle()
- text.next_to(brace.get_center_of_mass(), vect, buff = 1.2*MED_BUFF)
+ text.next_to(brace.get_center_of_mass(), vect, buff = 1.2*MED_SMALL_BUFF)
return VGroup(line, brace, text)
def get_tangent_line(self):
diff --git a/old_projects/wcat.py b/old_projects/wcat.py
index a48f65167..9eff8b425 100644
--- a/old_projects/wcat.py
+++ b/old_projects/wcat.py
@@ -1193,7 +1193,7 @@ class EdgesOfSquare(Scene):
n.next_to,
square.get_corner(vect+LEFT),
LEFT,
- MED_BUFF,
+ MED_SMALL_BUFF,
path_arc = np.pi/2
)
for n, vect in zip(self.numbers, [DOWN, UP])
@@ -2128,7 +2128,7 @@ class ThumbnailImage(ClosedLoopScene):
title.to_edge(UP)
title.gradient_highlight(YELLOW, MAROON_B)
self.add(title)
- self.loop.next_to(title, DOWN, buff = MED_BUFF)
+ self.loop.next_to(title, DOWN, buff = MED_SMALL_BUFF)
self.loop.shift(2*LEFT)
diff --git a/old_projects/zeta.py b/old_projects/zeta.py
index e9c214ad2..611fb8fa2 100644
--- a/old_projects/zeta.py
+++ b/old_projects/zeta.py
@@ -867,7 +867,7 @@ class ReadIntoZetaFunction(Scene):
Line(LEFT, ORIGIN).shift(0.4*DOWN)
)
paragraph_lines.scale_to_fit_width(max_width)
- paragraph_lines.next_to(title, DOWN, 2*MED_BUFF)
+ paragraph_lines.next_to(title, DOWN, MED_LARGE_BUFF)
paper.add(paragraph_lines)
max_height = 1.5*paragraph_lines.get_height()
@@ -879,7 +879,7 @@ class ReadIntoZetaFunction(Scene):
statement.next_to(paragraph_lines, DOWN)
statement.highlight(GREEN_B)
- paper.add(paragraph_lines.copy().next_to(statement, DOWN, 2*MED_BUFF))
+ paper.add(paragraph_lines.copy().next_to(statement, DOWN, MED_LARGE_BUFF))
randy.look_at(statement)
self.add(randy, paper)
@@ -1247,7 +1247,7 @@ class FromRealToComplex(ComplexTransformationScene):
converges and
makes sense
""")
- domain_words.to_corner(UP+RIGHT, buff = 2*MED_BUFF)
+ domain_words.to_corner(UP+RIGHT, buff = MED_LARGE_BUFF)
anti_domain_words = TextMobject("""
Not so much...
@@ -1400,7 +1400,7 @@ class TerritoryOfExponents(ComplexTransformationScene):
"\\left(\\frac{1}{2}\\right)^s"
)
exponent[-1].highlight(YELLOW)
- exponent.next_to(ORIGIN, LEFT, 2*MED_BUFF).to_edge(UP)
+ exponent.next_to(ORIGIN, LEFT, MED_LARGE_BUFF).to_edge(UP)
self.add_foreground_mobjects(exponent)
class ComplexExponentiation(Scene):
@@ -2091,7 +2091,7 @@ class ShowConditionalDefinition(Scene):
for s in ">", "\\le"
])
definitions = VGroup(sigma, something_else)
- definitions.arrange_submobjects(DOWN, buff = 2*MED_BUFF, aligned_edge = LEFT)
+ definitions.arrange_submobjects(DOWN, buff = MED_LARGE_BUFF, aligned_edge = LEFT)
conditions.arrange_submobjects(DOWN, buff = LARGE_BUFF)
definitions.shift(2*LEFT+2*UP)
conditions.next_to(definitions, RIGHT, buff = LARGE_BUFF, aligned_edge = DOWN)
diff --git a/scene/scene.py b/scene/scene.py
index 1ee634086..20158dcc1 100644
--- a/scene/scene.py
+++ b/scene/scene.py
@@ -14,7 +14,7 @@ from helpers import *
from camera import Camera
from tk_scene import TkSceneRoot
-from mobject import Mobject
+from mobject import Mobject, VMobject
from animation import Animation
from animation.transform import MoveToTarget
@@ -92,6 +92,7 @@ class Scene(object):
it.chain(*[
m.submobject_family()
for m in mobjects
+ if not (isinstance(m, VMobject) and m.is_subpath)
])
))
diff --git a/scene/zoomed_scene.py b/scene/zoomed_scene.py
index 5b8536f62..3344b4e79 100644
--- a/scene/zoomed_scene.py
+++ b/scene/zoomed_scene.py
@@ -102,6 +102,9 @@ class ZoomedScene(Scene):
def capture_mobjects_in_camera(self, mobjects, **kwargs):
self.camera.capture_mobjects(mobjects, **kwargs)
if self.zoom_activated:
+ if self.big_rectangle in mobjects:
+ mobjects = list(mobjects)
+ mobjects.remove(self.big_rectangle)
self.zoomed_camera.capture_mobjects(
mobjects, **kwargs
)
@@ -111,7 +114,8 @@ class ZoomedScene(Scene):
self, *animations
)
if self.zoom_activated and self.little_rectangle in moving_mobjects:
- # When the camera is moving, so is everything...
+ # When the camera is moving, so is everything,
+ mobjects = self.get_mobjects()
return self.get_mobjects(), []
else:
return moving_mobjects, static_mobjects
diff --git a/topics/objects.py b/topics/objects.py
index abb7b345d..b55bfbfdd 100644
--- a/topics/objects.py
+++ b/topics/objects.py
@@ -186,7 +186,7 @@ class Bubble(SVGMobject):
def resize_to_content(self):
target_width = self.content.get_width()
- target_width += max(2*MED_BUFF, 2)
+ target_width += max(MED_LARGE_BUFF, 2)
target_height = self.content.get_height()
target_height += 2.5*LARGE_BUFF
tip_point = self.get_tip()