mirror of
https://github.com/3b1b/manim.git
synced 2025-04-13 09:47:07 +00:00
alpha_func and interpoloation_function renamed to rate_func and path_func
This commit is contained in:
parent
0827db0259
commit
4b479cac1d
20 changed files with 98 additions and 98 deletions
|
@ -14,7 +14,7 @@ from mobject import Mobject
|
|||
class Animation(object):
|
||||
DEFAULT_CONFIG = {
|
||||
"run_time" : DEFAULT_ANIMATION_RUN_TIME,
|
||||
"alpha_func" : smooth,
|
||||
"rate_func" : smooth,
|
||||
"name" : None,
|
||||
}
|
||||
def __init__(self, mobject, **kwargs):
|
||||
|
@ -22,8 +22,8 @@ class Animation(object):
|
|||
assert(isinstance(mobject, Mobject))
|
||||
digest_config(self, kwargs, locals())
|
||||
self.starting_mobject = self.mobject.copy()
|
||||
if self.alpha_func is None:
|
||||
self.alpha_func = (lambda x : x)
|
||||
if self.rate_func is None:
|
||||
self.rate_func = (lambda x : x)
|
||||
if self.name is None:
|
||||
self.name = self.__class__.__name__ + str(self.mobject)
|
||||
self.update(0)
|
||||
|
@ -39,7 +39,7 @@ class Animation(object):
|
|||
alpha = 0.0
|
||||
if alpha > 1:
|
||||
alpha = 1.0
|
||||
self.update_mobject(self.alpha_func(alpha))
|
||||
self.update_mobject(self.rate_func(alpha))
|
||||
|
||||
def filter_out(self, *filter_functions):
|
||||
self.filter_functions += filter_functions
|
||||
|
@ -61,10 +61,10 @@ class Animation(object):
|
|||
self.run_time = time
|
||||
return self
|
||||
|
||||
def set_alpha_func(self, alpha_func):
|
||||
if alpha_func is None:
|
||||
alpha_func = lambda x : x
|
||||
self.alpha_func = alpha_func
|
||||
def set_rate_func(self, rate_func):
|
||||
if rate_func is None:
|
||||
rate_func = lambda x : x
|
||||
self.rate_func = rate_func
|
||||
return self
|
||||
|
||||
def set_name(self, name):
|
||||
|
|
|
@ -40,7 +40,7 @@ class DelayByOrder(Animation):
|
|||
|
||||
class TransformAnimations(Transform):
|
||||
DEFAULT_CONFIG = {
|
||||
"alpha_func" : squish_alpha_func(smooth)
|
||||
"rate_func" : squish_rate_func(smooth)
|
||||
}
|
||||
def __init__(self, start_anim, end_anim, **kwargs):
|
||||
digest_config(self, kwargs, locals())
|
||||
|
|
|
@ -16,7 +16,7 @@ class Vibrate(Animation):
|
|||
"amplitude" : 0.5,
|
||||
"radius" : SPACE_WIDTH/2,
|
||||
"run_time" : 3.0,
|
||||
"alpha_func" : None
|
||||
"rate_func" : None
|
||||
}
|
||||
def __init__(self, mobject = None, **kwargs):
|
||||
if mobject is None:
|
||||
|
@ -49,7 +49,7 @@ class Vibrate(Animation):
|
|||
|
||||
class TurnInsideOut(Transform):
|
||||
DEFAULT_CONFIG = {
|
||||
"interpolation_function" : path_along_arc(np.pi/2)
|
||||
"path_func" : path_along_arc(np.pi/2)
|
||||
}
|
||||
def __init__(self, mobject, **kwargs):
|
||||
mobject.sort_points(np.linalg.norm)
|
||||
|
|
|
@ -14,7 +14,7 @@ class Rotating(Animation):
|
|||
"axis" : None,
|
||||
"radians" : 2*np.pi,
|
||||
"run_time" : 20.0,
|
||||
"alpha_func" : None,
|
||||
"rate_func" : None,
|
||||
"in_place" : True,
|
||||
}
|
||||
def update_mobject(self, alpha):
|
||||
|
@ -68,7 +68,7 @@ class Flash(Animation):
|
|||
"color" : "white",
|
||||
"slow_factor" : 0.01,
|
||||
"run_time" : 0.1,
|
||||
"alpha_func" : None,
|
||||
"rate_func" : None,
|
||||
}
|
||||
def __init__(self, mobject, **kwargs):
|
||||
self.intermediate = Mobject(color = self.color)
|
||||
|
|
|
@ -11,7 +11,7 @@ from mobject import Mobject, Point
|
|||
|
||||
class Transform(Animation):
|
||||
DEFAULT_CONFIG = {
|
||||
"interpolation_function" : straight_path,
|
||||
"path_func" : straight_path,
|
||||
"should_black_out_extra_points" : False
|
||||
}
|
||||
def __init__(self, mobject, ending_mobject, **kwargs):
|
||||
|
@ -50,7 +50,7 @@ class Transform(Animation):
|
|||
)
|
||||
for m, start, end in zip(*families):
|
||||
# print m, start, end
|
||||
m.points = self.interpolation_function(
|
||||
m.points = self.path_func(
|
||||
start.points, end.points, alpha
|
||||
)
|
||||
m.rgbs = straight_path(start.rgbs, end.rgbs, alpha)
|
||||
|
@ -73,12 +73,12 @@ class Transform(Animation):
|
|||
|
||||
class ClockwiseTransform(Transform):
|
||||
DEFAULT_CONFIG = {
|
||||
"interpolation_function" : clockwise_path()
|
||||
"path_func" : clockwise_path()
|
||||
}
|
||||
|
||||
class CounterclockwiseTransform(Transform):
|
||||
DEFAULT_CONFIG = {
|
||||
"interpolation_function" : counterclockwise_path()
|
||||
"path_func" : counterclockwise_path()
|
||||
}
|
||||
|
||||
class GrowFromCenter(Transform):
|
||||
|
@ -92,7 +92,7 @@ class GrowFromCenter(Transform):
|
|||
|
||||
class SpinInFromNothing(GrowFromCenter):
|
||||
DEFAULT_CONFIG = {
|
||||
"interpolation_function" : counterclockwise_path()
|
||||
"path_func" : counterclockwise_path()
|
||||
}
|
||||
|
||||
class ShrinkToCenter(Transform):
|
||||
|
@ -125,7 +125,7 @@ class Rotate(ApplyMethod):
|
|||
"in_place" : False,
|
||||
}
|
||||
def __init__(self, mobject, angle = np.pi, axis = OUT, **kwargs):
|
||||
kwargs["interpolation_function"] = path_along_arc(angle)
|
||||
kwargs["path_func"] = path_along_arc(angle)
|
||||
digest_config(self, kwargs, locals())
|
||||
if self.in_place:
|
||||
method = mobject.rotate_in_place
|
||||
|
|
|
@ -266,7 +266,7 @@ def not_quite_there(func = smooth, proportion = 0.7):
|
|||
def wiggle(t, wiggles = 2):
|
||||
return there_and_back(t) * np.sin(wiggles*np.pi*t)
|
||||
|
||||
def squish_alpha_func(func, a = 0.4, b = 0.6):
|
||||
def squish_rate_func(func, a = 0.4, b = 0.6):
|
||||
def result(t):
|
||||
if t < a:
|
||||
return func(0)
|
||||
|
|
|
@ -145,7 +145,7 @@ class PostponePhilosophizing(Scene):
|
|||
self.play(*[
|
||||
ApplyMethod(
|
||||
word1.replace, word2,
|
||||
interpolation_function = path_along_arc(np.pi/2)
|
||||
path_func = path_along_arc(np.pi/2)
|
||||
)
|
||||
for word1, word2 in it.permutations([abstract, concrete])
|
||||
])
|
||||
|
@ -176,7 +176,7 @@ class ImageToSound(Scene):
|
|||
self.play(Transform(
|
||||
picture, string.mobject,
|
||||
run_time = 3,
|
||||
alpha_func = rush_into
|
||||
rate_func = rush_into
|
||||
))
|
||||
self.remove(picture)
|
||||
self.play(string)
|
||||
|
@ -187,7 +187,7 @@ class ImageToSound(Scene):
|
|||
self.play(Transform(
|
||||
string.mobject, picture_copy,
|
||||
run_time = 5,
|
||||
alpha_func = rush_from
|
||||
rate_func = rush_from
|
||||
))
|
||||
|
||||
|
||||
|
@ -268,7 +268,7 @@ class SoundDataIsOneDimensional(Scene):
|
|||
Transform(
|
||||
dot,
|
||||
dot.copy().scale(2).rotate(-np.pi/2).shift(floor),
|
||||
interpolation_function = path_along_arc(np.pi/3)
|
||||
path_func = path_along_arc(np.pi/3)
|
||||
)
|
||||
for dot in dots
|
||||
]
|
||||
|
@ -433,7 +433,7 @@ class ListenToAllPixels(Scene):
|
|||
self.play(
|
||||
ShimmerIn(
|
||||
words,
|
||||
alpha_func = squish_alpha_func(smooth, 0, 0.2)
|
||||
rate_func = squish_rate_func(smooth, 0, 0.2)
|
||||
),
|
||||
*sub_vibrations,
|
||||
run_time = 5
|
||||
|
@ -493,12 +493,12 @@ class RandomMapping(Scene):
|
|||
self.add(grid)
|
||||
targets = [stars, freq_line]
|
||||
alphas = [not_quite_there(rush_into), rush_from]
|
||||
for target, alpha_func in zip(targets, alphas):
|
||||
for target, rate_func in zip(targets, alphas):
|
||||
self.play(Transform(
|
||||
grid, target,
|
||||
run_time = 3,
|
||||
alpha_func = alpha_func,
|
||||
interpolation_function = path_along_arc(-np.pi/2)
|
||||
rate_func = rate_func,
|
||||
path_func = path_along_arc(-np.pi/2)
|
||||
))
|
||||
self.dither()
|
||||
|
||||
|
@ -543,7 +543,7 @@ class ThinkInTermsOfReverseMapping(Scene):
|
|||
self.dither()
|
||||
self.play(ApplyMethod(
|
||||
arrow.rotate, np.pi,
|
||||
interpolation_function = clockwise_path()
|
||||
path_func = clockwise_path()
|
||||
))
|
||||
self.dither()
|
||||
self.play(ShowCreation(arrow1))
|
||||
|
@ -615,7 +615,7 @@ class WeaveLineThroughPixels(Scene):
|
|||
self.play(ShowCreation(
|
||||
curve,
|
||||
run_time = 5,
|
||||
alpha_func = None
|
||||
rate_func = None
|
||||
))
|
||||
self.dither()
|
||||
self.play(
|
||||
|
@ -639,7 +639,7 @@ class WellPlayedGameOfSnake(Scene):
|
|||
self.play(ShowCreation(
|
||||
snake_curve,
|
||||
run_time = 7,
|
||||
alpha_func = None
|
||||
rate_func = None
|
||||
))
|
||||
self.dither()
|
||||
self.play(ShimmerIn(words))
|
||||
|
@ -720,7 +720,7 @@ class Order1PseudoHilbertCurve(Scene):
|
|||
self.dither()
|
||||
self.play(Transform(
|
||||
s, pre_words,
|
||||
interpolation_function = path_along_arc(-np.pi/3)
|
||||
path_func = path_along_arc(-np.pi/3)
|
||||
))
|
||||
self.dither()
|
||||
self.play(ShowCreation(grid1))
|
||||
|
@ -729,7 +729,7 @@ class Order1PseudoHilbertCurve(Scene):
|
|||
self.dither()
|
||||
kwargs = {
|
||||
"run_time" : 5,
|
||||
"alpha_func" : None
|
||||
"rate_func" : None
|
||||
}
|
||||
self.play(ShowCreation(curve, **kwargs))
|
||||
self.dither()
|
||||
|
@ -877,7 +877,7 @@ class UseOrder8(Scene):
|
|||
self.clear()
|
||||
self.add(words)
|
||||
self.play(ShowCreation(
|
||||
curve, run_time = 7, alpha_func = None
|
||||
curve, run_time = 7, rate_func = None
|
||||
))
|
||||
self.dither()
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ class AskMathematicianFriend(Scene):
|
|||
self.dither()
|
||||
self.play(ApplyMethod(
|
||||
mathy.blink,
|
||||
alpha_func = squish_alpha_func(there_and_back)
|
||||
rate_func = squish_rate_func(there_and_back)
|
||||
))
|
||||
self.dither()
|
||||
self.play(ShowCreation(bubble))
|
||||
|
@ -163,7 +163,7 @@ class TimeLineAboutSpaceFilling(Scene):
|
|||
self.play(ShowCreation(
|
||||
curve,
|
||||
run_time = 5,
|
||||
alpha_func = None
|
||||
rate_func = None
|
||||
))
|
||||
self.dither()
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ class ConjugateDivisionExample(ComplexMultiplication):
|
|||
self.draw_dot("\\bar z", self.multiplier)
|
||||
self.apply_multiplication()
|
||||
self.multiplier = 1./(abs(num)**2)
|
||||
self.anim_config["interpolation_function"] = straight_path
|
||||
self.anim_config["path_func"] = straight_path
|
||||
self.apply_multiplication()
|
||||
self.dither()
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ class IllustrateDuality(GraphScene):
|
|||
return 1
|
||||
kwargs = {
|
||||
"run_time" : 5.0,
|
||||
"alpha_func" : special_alpha
|
||||
"rate_func" : special_alpha
|
||||
}
|
||||
self.play(*[
|
||||
Transform(*edge_pair, **kwargs)
|
||||
|
@ -125,7 +125,7 @@ class IntroduceGraph(GraphScene):
|
|||
self.add(graph)
|
||||
self.dither()
|
||||
kwargs = {
|
||||
"alpha_func" : there_and_back,
|
||||
"rate_func" : there_and_back,
|
||||
"run_time" : 5.0
|
||||
}
|
||||
self.add(not_okay)
|
||||
|
@ -144,7 +144,7 @@ class IntroduceGraph(GraphScene):
|
|||
self.remove(*edges_to_remove)
|
||||
self.play(ShowCreation(
|
||||
Mobject(*edges_to_remove),
|
||||
alpha_func = lambda t : 1 - t,
|
||||
rate_func = lambda t : 1 - t,
|
||||
run_time = 1.0
|
||||
))
|
||||
self.dither(2)
|
||||
|
@ -965,7 +965,7 @@ class IntroduceMortimer(GraphScene):
|
|||
ApplyMethod(
|
||||
line.rotate_in_place,
|
||||
np.pi/10,
|
||||
alpha_func = wiggle)
|
||||
rate_func = wiggle)
|
||||
for line in morty_crossed_lines
|
||||
], **kwargs)
|
||||
|
||||
|
@ -992,7 +992,7 @@ class RandolphMortimerSpanningTreeGame(GraphScene):
|
|||
self.dither()
|
||||
self.play(WalkPiCreature(
|
||||
morty, self.dual_points[attempted_dual_point_index],
|
||||
alpha_func = lambda t : 0.3 * there_and_back(t),
|
||||
rate_func = lambda t : 0.3 * there_and_back(t),
|
||||
run_time = 2.0,
|
||||
))
|
||||
self.dither()
|
||||
|
@ -1039,7 +1039,7 @@ class MortimerCannotTraverseCycle(GraphScene):
|
|||
|
||||
all_lines = []
|
||||
matching_edges = []
|
||||
kwargs = {"run_time" : time_per_edge, "alpha_func" : None}
|
||||
kwargs = {"run_time" : time_per_edge, "rate_func" : None}
|
||||
for last, next in zip(dual_cycle, dual_cycle[1:]):
|
||||
line = Line(self.dual_points[last], self.dual_points[next])
|
||||
line.highlight("red")
|
||||
|
|
|
@ -181,7 +181,7 @@ class IntroduceDivergentSum(Scene):
|
|||
end_brace = deepcopy(brace).stretch_to_fit_width(
|
||||
max(ellipses.points[:,0])-min_x_coord
|
||||
).to_edge(LEFT, buff = SPACE_WIDTH+min_x_coord)
|
||||
kwargs = {"run_time" : 5.0, "alpha_func" : rush_into}
|
||||
kwargs = {"run_time" : 5.0, "rate_func" : rush_into}
|
||||
flip_through = FlipThroughNumbers(
|
||||
lambda x : 2**(x+1)-1,
|
||||
start = NUM_WRITTEN_TERMS-1,
|
||||
|
@ -448,7 +448,7 @@ class ZoomInOnInterval(Scene):
|
|||
ApplyMethod(new_line.apply_function, squish),
|
||||
ApplyMethod(
|
||||
interval[0].apply_function, squish,
|
||||
alpha_func = lambda t : 1-t
|
||||
rate_func = lambda t : 1-t
|
||||
),
|
||||
*[FadeIn(interval[x]) for x in [1, 2]]
|
||||
)
|
||||
|
@ -690,7 +690,7 @@ class ListOfPartialSums(Scene):
|
|||
)
|
||||
self.dither()
|
||||
self.play(*[
|
||||
ApplyMethod(s.highlight, "yellow", alpha_func = there_and_back)
|
||||
ApplyMethod(s.highlight, "yellow", rate_func = there_and_back)
|
||||
for s in sums
|
||||
])
|
||||
self.dither()
|
||||
|
@ -768,7 +768,7 @@ class CircleZoomInOnOne(Scene):
|
|||
self.play(
|
||||
ShowCreation(
|
||||
curr_num,
|
||||
alpha_func = lambda t : smooth(1-t)
|
||||
rate_func = lambda t : smooth(1-t)
|
||||
),
|
||||
ShowCreation(num)
|
||||
)
|
||||
|
@ -816,7 +816,7 @@ class ZoomInOnOne(Scene):
|
|||
).scale(1.0/scale_val**x)
|
||||
for x in range(num_levels)
|
||||
]
|
||||
kwargs = {"alpha_func" : None}
|
||||
kwargs = {"rate_func" : None}
|
||||
self.play(*[
|
||||
ApplyMethod(number_lines[x].scale, scale_val, **kwargs)
|
||||
for x in range(1, num_levels)
|
||||
|
@ -1915,7 +1915,7 @@ class RoomsAndSubroomsWithNumbers(Scene):
|
|||
self.play(*[
|
||||
ApplyMethod(
|
||||
num_mobs[index].rotate_in_place, np.pi/10,
|
||||
alpha_func = wiggle
|
||||
rate_func = wiggle
|
||||
)
|
||||
for index in pair
|
||||
])
|
||||
|
@ -2036,7 +2036,7 @@ class PAdicMetric(Scene):
|
|||
self.play(
|
||||
ShowCreation(
|
||||
arrow,
|
||||
alpha_func = squish_alpha_func(smooth, 0.5, 1.0)
|
||||
rate_func = squish_rate_func(smooth, 0.5, 1.0)
|
||||
),
|
||||
DelayByOrder(Transform(
|
||||
start,
|
||||
|
|
|
@ -237,7 +237,7 @@ class ShowMatrixTransform(TransformScene2D):
|
|||
self.dither()
|
||||
kwargs = {
|
||||
"run_time" : 2.0,
|
||||
"interpolation_function" : self.get_interpolation_function(matrix)
|
||||
"path_func" : self.get_path_func(matrix)
|
||||
}
|
||||
anims = [ApplyFunction(func, self.number_plane, **kwargs)]
|
||||
if hasattr(self, "x_arrow") and hasattr(self, "y_arrow"):
|
||||
|
@ -264,7 +264,7 @@ class ShowMatrixTransform(TransformScene2D):
|
|||
])
|
||||
return max(max_norm, 1)
|
||||
|
||||
def get_interpolation_function(self, matrix):
|
||||
def get_path_func(self, matrix):
|
||||
rotational_components = np.array([
|
||||
np.log(multiplier*complex(*matrix[:,i])).imag
|
||||
for i, multiplier in [(0, 1), (1, complex(0, -1))]
|
||||
|
@ -476,7 +476,7 @@ class ShowMatrixTransformWithDot(TransformScene2D):
|
|||
self.remove(x_arrow_copy, y_arrow_copy)
|
||||
kwargs = {
|
||||
"run_time" : 2.0,
|
||||
"interpolation_function" : self.get_interpolation_function(matrix)
|
||||
"path_func" : self.get_path_func(matrix)
|
||||
}
|
||||
anims = [
|
||||
ApplyFunction(func, self.number_plane, **kwargs),
|
||||
|
@ -513,7 +513,7 @@ class ShowMatrixTransformWithDot(TransformScene2D):
|
|||
])
|
||||
return max(max_norm, 1)
|
||||
|
||||
def get_interpolation_function(self, matrix):
|
||||
def get_path_func(self, matrix):
|
||||
rotational_components = [
|
||||
sign*np.arccos(matrix[i,i]/np.linalg.norm(matrix[:,i]))
|
||||
for i in [0, 1]
|
||||
|
|
|
@ -472,7 +472,7 @@ class LineCorrespondsWithPair(CircleScene):
|
|||
self.play(*[
|
||||
Transform(
|
||||
dot, Dot(dot.get_center(), 3*dot.radius),
|
||||
alpha_func = there_and_back
|
||||
rate_func = there_and_back
|
||||
)
|
||||
for dot in (dot0, dot1)
|
||||
])
|
||||
|
@ -599,7 +599,7 @@ class IntersectionPointCorrespondances(CircleScene):
|
|||
dot_highlights.append(Highlight(mob))
|
||||
dot_pointers.append(Arrow(mob.get_center()).nudge())
|
||||
elif mob != intersection_dot:
|
||||
fade_outs.append(FadeOut(mob, alpha_func = not_quite_there))
|
||||
fade_outs.append(FadeOut(mob, rate_func = not_quite_there))
|
||||
|
||||
self.add(intersection_dot_arrow)
|
||||
self.play(Highlight(intersection_dot))
|
||||
|
@ -638,7 +638,7 @@ class LinesIntersectOutside(CircleScene):
|
|||
for p0, p1 in [(0, 1), (2, 3)]
|
||||
]
|
||||
self.play(*[
|
||||
FadeOut(mob, alpha_func = not_quite_there)
|
||||
FadeOut(mob, rate_func = not_quite_there)
|
||||
for mob in self.mobjects if mob not in lines_to_save
|
||||
])
|
||||
self.play(*[
|
||||
|
@ -902,7 +902,7 @@ class ShowMoserGraphLines(CircleScene):
|
|||
self.play(CounterclockwiseTransform(
|
||||
compound,
|
||||
deepcopy(compound).scale(1.05),
|
||||
alpha_func = there_and_back,
|
||||
rate_func = there_and_back,
|
||||
run_time = 2.0,
|
||||
))
|
||||
else:
|
||||
|
@ -980,7 +980,7 @@ class HowIntersectionChopsLine(CircleScene):
|
|||
(-3, h, 0),
|
||||
(3, h, 0)
|
||||
),
|
||||
alpha_func = there_and_back,
|
||||
rate_func = there_and_back,
|
||||
run_time = 3.0
|
||||
)
|
||||
for line, h in zip(lines, (-1, 1))
|
||||
|
|
|
@ -135,7 +135,7 @@ class Vibrate(Animation):
|
|||
"center" : ORIGIN,
|
||||
"color" : "white",
|
||||
"run_time" : 3.0,
|
||||
"alpha_func" : None
|
||||
"rate_func" : None
|
||||
}
|
||||
def __init__(self, **kwargs):
|
||||
digest_config(self, kwargs)
|
||||
|
@ -302,7 +302,7 @@ class MeasureTheoryToHarmony(IntervalScene):
|
|||
line = Line(radius*LEFT, radius*RIGHT).highlight("white")
|
||||
self.play(DelayByOrder(Transform(all_mobs, line)))
|
||||
self.clear()
|
||||
self.play(Vibrate(alpha_func = smooth))
|
||||
self.play(Vibrate(rate_func = smooth))
|
||||
self.clear()
|
||||
self.add(line)
|
||||
self.dither()
|
||||
|
@ -367,7 +367,7 @@ class ChallengeOne(Scene):
|
|||
r2 = TexMobject("r").next_to(arrow2, UP)
|
||||
kwargs = {
|
||||
"run_time" : 5.0,
|
||||
"alpha_func" : there_and_back
|
||||
"rate_func" : there_and_back
|
||||
}
|
||||
run_time = 3.0
|
||||
vibrations = [self.bottom_vibration, top_vib_1, top_vib_2]
|
||||
|
@ -495,7 +495,7 @@ class DecomposeMusicalNote(Scene):
|
|||
sine = LongSine()
|
||||
kwargs = {
|
||||
"run_time" : 4.0,
|
||||
"alpha_func" : None
|
||||
"rate_func" : None
|
||||
}
|
||||
words = TextMobject("Imagine 220 per second...")
|
||||
words.shift(2*UP)
|
||||
|
@ -503,9 +503,9 @@ class DecomposeMusicalNote(Scene):
|
|||
self.add(line)
|
||||
self.play(ApplyMethod(sine.shift, 4*LEFT, **kwargs))
|
||||
self.add(words)
|
||||
kwargs["alpha_func"] = rush_into
|
||||
kwargs["rate_func"] = rush_into
|
||||
self.play(ApplyMethod(sine.shift, 80*LEFT, **kwargs))
|
||||
kwargs["alpha_func"] = None
|
||||
kwargs["rate_func"] = None
|
||||
kwargs["run_time"] = 1.0
|
||||
sine.to_edge(LEFT, buff = 0)
|
||||
for x in range(5):
|
||||
|
@ -523,7 +523,7 @@ class DecomposeTwoFrequencies(Scene):
|
|||
self.play(ApplyMethod(
|
||||
comp.shift, 15*LEFT,
|
||||
run_time = 7.5,
|
||||
alpha_func = None
|
||||
rate_func = None
|
||||
))
|
||||
|
||||
|
||||
|
@ -576,7 +576,7 @@ class PatternInFrequencies(Scene):
|
|||
top_lines.highlight(color)
|
||||
kwargs = {
|
||||
"run_time" : 10,
|
||||
"alpha_func" : None
|
||||
"rate_func" : None
|
||||
}
|
||||
|
||||
self.add(big_line)
|
||||
|
@ -706,7 +706,7 @@ class PianoTuning(Scene):
|
|||
FadeIn(twelfth_root)
|
||||
)
|
||||
self.dither()
|
||||
self.play(ShowCreation(semicircles, alpha_func = None))
|
||||
self.play(ShowCreation(semicircles, rate_func = None))
|
||||
self.dither()
|
||||
|
||||
self.show_interval(5, 7)
|
||||
|
@ -853,7 +853,7 @@ class AllValuesBetween1And2(NumberLineScene):
|
|||
|
||||
kwargs = {
|
||||
"run_time" : 3.0,
|
||||
"alpha_func" : there_and_back
|
||||
"rate_func" : there_and_back
|
||||
}
|
||||
self.play(*[
|
||||
ApplyMethod(mob.shift, RIGHT, **kwargs)
|
||||
|
@ -922,7 +922,7 @@ class CoveringSetsWithOpenIntervals(IntervalScene):
|
|||
self.dither()
|
||||
for x in range(2*len(theorems)):
|
||||
self.play(*[
|
||||
ApplyMethod(th.shift, UP, alpha_func = None)
|
||||
ApplyMethod(th.shift, UP, rate_func = None)
|
||||
for th in theorems[:x+1]
|
||||
])
|
||||
|
||||
|
@ -972,17 +972,17 @@ class NaiveFractionCover(IntervalScene):
|
|||
if count == 0:
|
||||
kwargs = {
|
||||
"run_time" : 1.0,
|
||||
"alpha_func" : rush_into
|
||||
"rate_func" : rush_into
|
||||
}
|
||||
elif count == 10:
|
||||
kwargs = {
|
||||
"run_time" : 1.0,
|
||||
"alpha_func" : rush_from
|
||||
"rate_func" : rush_from
|
||||
}
|
||||
else:
|
||||
kwargs = {
|
||||
"run_time" : 0.25,
|
||||
"alpha_func" : None
|
||||
"rate_func" : None
|
||||
}
|
||||
open_interval, line = self.add_open_interval(num, 0.1)
|
||||
open_interval.shift(UP)
|
||||
|
@ -1203,7 +1203,7 @@ class StepsToSolution(IntervalScene):
|
|||
self.intervals = [a.mobject for a in anims]
|
||||
kwargs = {
|
||||
"run_time" : 2.0,
|
||||
"alpha_func" : there_and_back
|
||||
"rate_func" : there_and_back
|
||||
}
|
||||
self.play(*[
|
||||
ApplyMethod(mob.scale_in_place, 0.5*random.random(), **kwargs)
|
||||
|
@ -1339,7 +1339,7 @@ class TroubleDrawingSmallInterval(IntervalScene):
|
|||
self.play(Transform(
|
||||
line, deepcopy(line).scale(10).shift(DOWN),
|
||||
run_time = 2.0,
|
||||
alpha_func = there_and_back
|
||||
rate_func = there_and_back
|
||||
))
|
||||
self.dither()
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ class TauPoem(Scene):
|
|||
number_word.shift(BUFF * UP / 2)
|
||||
|
||||
kwargs = {
|
||||
"alpha_func" : squish_alpha_func(smooth),
|
||||
"rate_func" : squish_rate_func(smooth),
|
||||
}
|
||||
self.add(first_word, rest_of_line, self.first_digits)
|
||||
self.first_word = first_word
|
||||
|
@ -167,13 +167,13 @@ class TauPoem(Scene):
|
|||
self.play_over_time_range(0, 2,
|
||||
Transform(
|
||||
deepcopy(self.first_word), self.number_word,
|
||||
alpha_func = squish_alpha_func(smooth)
|
||||
rate_func = squish_rate_func(smooth)
|
||||
)
|
||||
)
|
||||
self.play_over_time_range(2, 4,
|
||||
Transform(
|
||||
self.number_word, self.new_digit,
|
||||
alpha_func = squish_alpha_func(smooth)
|
||||
rate_func = squish_rate_func(smooth)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -183,7 +183,7 @@ class TauPoem(Scene):
|
|||
two_copy = deepcopy(two).rotate(np.pi/10).highlight("yellow")
|
||||
self.play(Transform(
|
||||
two, two_copy,
|
||||
alpha_func = squish_alpha_func(
|
||||
rate_func = squish_rate_func(
|
||||
lambda t : wiggle(t),
|
||||
0.4, 0.9,
|
||||
),
|
||||
|
@ -204,12 +204,12 @@ class TauPoem(Scene):
|
|||
self.dither()
|
||||
self.play(CounterclockwiseTransform(
|
||||
two_pi, sphere,
|
||||
alpha_func = lambda t : 2*smooth(t/2)
|
||||
rate_func = lambda t : 2*smooth(t/2)
|
||||
))
|
||||
self.remove(two_pi)
|
||||
self.play(CounterclockwiseTransform(
|
||||
sphere, tau,
|
||||
alpha_func = lambda t : 2*(smooth(t/2+0.5)-0.5)
|
||||
rate_func = lambda t : 2*(smooth(t/2+0.5)-0.5)
|
||||
))
|
||||
self.remove(sphere)
|
||||
self.add(tau)
|
||||
|
@ -286,7 +286,7 @@ class TauPoem(Scene):
|
|||
self.play(ApplyFunction(
|
||||
lambda p : 2 * p / np.linalg.norm(p),
|
||||
bubble,
|
||||
alpha_func = wiggle,
|
||||
rate_func = wiggle,
|
||||
run_time = 3.0,
|
||||
))
|
||||
|
||||
|
@ -406,7 +406,7 @@ class TauPoem(Scene):
|
|||
ShowCreation(sine),
|
||||
ShowCreation(deepcopy(sine).shift(2*np.pi*interval_size*RIGHT)),
|
||||
run_time = 2.0,
|
||||
alpha_func = smooth
|
||||
rate_func = smooth
|
||||
),
|
||||
ShowCreation(circle)
|
||||
)
|
||||
|
@ -521,7 +521,7 @@ class TauPoem(Scene):
|
|||
self.add(*pi.parts + tau.parts)
|
||||
self.dither(0.8)
|
||||
self.play(*[
|
||||
Transform(*eyes, run_time = 0.2, alpha_func = rush_into)
|
||||
Transform(*eyes, run_time = 0.2, rate_func = rush_into)
|
||||
for eyes in [
|
||||
(tau.left_eye, blinked_tau.left_eye),
|
||||
(tau.right_eye, blinked_tau.right_eye),
|
||||
|
@ -529,7 +529,7 @@ class TauPoem(Scene):
|
|||
])
|
||||
self.remove(tau.left_eye, tau.right_eye)
|
||||
self.play(*[
|
||||
Transform(*eyes, run_time = 0.2, alpha_func = rush_from)
|
||||
Transform(*eyes, run_time = 0.2, rate_func = rush_from)
|
||||
for eyes in [
|
||||
(blinked_tau.left_eye, mad_tau.left_eye),
|
||||
(blinked_tau.right_eye, mad_tau.right_eye),
|
||||
|
@ -546,7 +546,7 @@ class TauPoem(Scene):
|
|||
self.add(*mad_tau.parts)
|
||||
|
||||
self.play(*[
|
||||
Transform(*eyes, run_time = 0.2, alpha_func = rush_into)
|
||||
Transform(*eyes, run_time = 0.2, rate_func = rush_into)
|
||||
for eyes in [
|
||||
(pi.left_eye, blinked_pi.left_eye),
|
||||
(pi.right_eye, blinked_pi.right_eye),
|
||||
|
@ -554,7 +554,7 @@ class TauPoem(Scene):
|
|||
])
|
||||
self.remove(pi.left_eye, pi.right_eye)
|
||||
self.play(*[
|
||||
Transform(*eyes, run_time = 0.2, alpha_func = rush_from)
|
||||
Transform(*eyes, run_time = 0.2, rate_func = rush_from)
|
||||
for eyes in [
|
||||
(blinked_pi.left_eye, sad_pi.left_eye),
|
||||
(blinked_pi.right_eye, sad_pi.right_eye),
|
||||
|
|
|
@ -19,7 +19,7 @@ class RearrangeEquation(Scene):
|
|||
leave_start_terms = False,
|
||||
transform_kwargs = {},
|
||||
):
|
||||
transform_kwargs["interpolation_function"] = path
|
||||
transform_kwargs["path_func"] = path
|
||||
start_mobs, end_mobs = self.get_mobs_from_terms(
|
||||
start_terms, end_terms, size
|
||||
)
|
||||
|
|
|
@ -77,8 +77,8 @@ class ComplexPlane(NumberPlane):
|
|||
|
||||
class ComplexFunction(ApplyPointwiseFunction):
|
||||
def __init__(self, function, mobject = ComplexPlane, **kwargs):
|
||||
if "interpolation_function" not in kwargs:
|
||||
self.interpolation_function = path_along_arc(
|
||||
if "path_func" not in kwargs:
|
||||
self.path_func = path_along_arc(
|
||||
np.log(function(complex(1))).imag
|
||||
)
|
||||
ApplyPointwiseFunction.__init__(
|
||||
|
@ -133,7 +133,7 @@ class ComplexMultiplication(Scene):
|
|||
# plane.add_spider_web()
|
||||
self.anim_config = {
|
||||
"run_time" : 2.0,
|
||||
"interpolation_function" : path_along_arc(arg)
|
||||
"path_func" : path_along_arc(arg)
|
||||
}
|
||||
|
||||
plane_config["faded_line_frequency"] = 0.5
|
||||
|
|
|
@ -233,7 +233,7 @@ class GraphScene(Scene):
|
|||
for point in self.points
|
||||
])
|
||||
self.play(Transform(
|
||||
start, end, alpha_func = there_and_back,
|
||||
start, end, rate_func = there_and_back,
|
||||
**kwargs
|
||||
))
|
||||
self.remove(start)
|
||||
|
|
|
@ -316,11 +316,11 @@ class NumberLineScene(Scene):
|
|||
self.add(*additional_mobjects)
|
||||
|
||||
def show_multiplication(self, num, **kwargs):
|
||||
if "interpolation_function" not in kwargs:
|
||||
if "path_func" not in kwargs:
|
||||
if num > 0:
|
||||
kwargs["interpolation_function"] = straight_path
|
||||
kwargs["path_func"] = straight_path
|
||||
else:
|
||||
kwargs["interpolation_function"] = counterclockwise_path()
|
||||
kwargs["path_func"] = counterclockwise_path()
|
||||
self.play(*[
|
||||
ApplyMethod(self.number_line.stretch, num, 0, **kwargs)
|
||||
]+[
|
||||
|
|
|
@ -40,7 +40,7 @@ class SingleVariableFunction(Scene):
|
|||
|
||||
transform_config = {
|
||||
"run_time" : 3,
|
||||
"interpolation_function" : path_along_arc(np.pi/4)
|
||||
"path_func" : path_along_arc(np.pi/4)
|
||||
}
|
||||
|
||||
if separate_lines:
|
||||
|
@ -272,7 +272,7 @@ class PlaneToSpaceFunction(Scene):
|
|||
TransformAnimations(
|
||||
Animation(plane.copy()),
|
||||
Rotating(target, **rot_kwargs),
|
||||
alpha_func = smooth
|
||||
rate_func = smooth
|
||||
),
|
||||
Rotating(axes, **rot_kwargs)
|
||||
)
|
||||
|
@ -309,7 +309,7 @@ class SpaceToSpaceFunction(Scene):
|
|||
TransformAnimations(
|
||||
Rotating(space, **rot_kwargs),
|
||||
Rotating(target, **rot_kwargs),
|
||||
alpha_func = squish_alpha_func(smooth, 0.3, 0.7)
|
||||
rate_func = squish_rate_func(smooth, 0.3, 0.7)
|
||||
),
|
||||
Rotating(axes, **rot_kwargs)
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue