mirror of
https://github.com/3b1b/manim.git
synced 2025-07-30 13:34:19 +08:00
scale_to_fit_width -> set_width, likewise for height and depth
This commit is contained in:
@ -117,12 +117,12 @@ class TakeOver(PiCreatureScene):
|
||||
|
||||
def construct(self):
|
||||
gradient = ImageMobject("white_black_gradient")
|
||||
gradient.scale_to_fit_height(FRAME_HEIGHT)
|
||||
gradient.set_height(FRAME_HEIGHT)
|
||||
self.add(gradient)
|
||||
|
||||
morty = self.pi_creatures
|
||||
henry = ImageMobject("Henry_As_Stick")
|
||||
henry.scale_to_fit_height(4)
|
||||
henry.set_height(4)
|
||||
henry.to_edge(LEFT)
|
||||
henry.to_edge(DOWN)
|
||||
|
||||
@ -329,7 +329,7 @@ class ShowFullStory(Scene):
|
||||
images.shift(-images[0].get_center())
|
||||
|
||||
self.play(
|
||||
images.scale_to_fit_width, FRAME_WIDTH - 1,
|
||||
images.set_width, FRAME_WIDTH - 1,
|
||||
images.center,
|
||||
run_time=3,
|
||||
)
|
||||
@ -355,10 +355,10 @@ class FeynmanAndOrbitingPlannetOnEllipseDiagram(ShowEmergingEllipse):
|
||||
e_dot.set_color(YELLOW)
|
||||
|
||||
comet = ImageMobject("earth")
|
||||
comet.scale_to_fit_width(0.3)
|
||||
comet.set_width(0.3)
|
||||
|
||||
feynman = ImageMobject("Feynman")
|
||||
feynman.scale_to_fit_height(6)
|
||||
feynman.set_height(6)
|
||||
feynman.next_to(ORIGIN, LEFT)
|
||||
feynman.to_edge(UP)
|
||||
feynman_name = TextMobject("Richard Feynman")
|
||||
@ -394,7 +394,7 @@ class FeynmanFame(Scene):
|
||||
ImageMobject("Feynman_Lectures_cover"),
|
||||
)
|
||||
for book in books:
|
||||
book.scale_to_fit_height(6)
|
||||
book.set_height(6)
|
||||
book.move_to(FRAME_WIDTH * LEFT / 4)
|
||||
|
||||
feynman_diagram = self.get_feynman_diagram()
|
||||
@ -428,14 +428,14 @@ class FeynmanFame(Scene):
|
||||
safe.add_to_back(safe_rect)
|
||||
|
||||
bongo = SVGMobject(file_name="bongo")
|
||||
bongo.scale_to_fit_height(1)
|
||||
bongo.set_height(1)
|
||||
bongo.set_color(WHITE)
|
||||
bongo.next_to(safe, RIGHT, LARGE_BUFF)
|
||||
|
||||
objects = VGroup(safe, bongo)
|
||||
|
||||
feynman_smile = ImageMobject("Feynman_Los_Alamos")
|
||||
feynman_smile.scale_to_fit_height(4)
|
||||
feynman_smile.set_height(4)
|
||||
feynman_smile.next_to(objects, DOWN)
|
||||
|
||||
VGroup(objects, feynman_smile).next_to(ORIGIN, RIGHT)
|
||||
@ -470,7 +470,7 @@ class FeynmanFame(Scene):
|
||||
|
||||
# As a teacher
|
||||
feynman_teacher = ImageMobject("Feynman_teaching")
|
||||
feynman_teacher.scale_to_fit_width(FRAME_WIDTH / 2 - 1)
|
||||
feynman_teacher.set_width(FRAME_WIDTH / 2 - 1)
|
||||
feynman_teacher.next_to(ORIGIN, RIGHT)
|
||||
|
||||
self.play(self.get_book_intro(feynman_teacher))
|
||||
@ -589,7 +589,7 @@ class TheMotionOfPlanets(Scene):
|
||||
|
||||
def setup_orbits(self):
|
||||
sun = ImageMobject("sun")
|
||||
sun.scale_to_fit_height(0.7)
|
||||
sun.set_height(0.7)
|
||||
planets, ellipses, orbits = self.get_planets_ellipses_and_orbits(sun)
|
||||
|
||||
archivist_words = TextMobject(
|
||||
@ -603,7 +603,7 @@ class TheMotionOfPlanets(Scene):
|
||||
alt_name.add_background_rectangle()
|
||||
|
||||
book = ImageMobject("Lost_Lecture_cover")
|
||||
book.scale_to_fit_height(4)
|
||||
book.set_height(4)
|
||||
book.next_to(alt_name, DOWN)
|
||||
|
||||
self.add(SunAnimation(sun))
|
||||
@ -638,7 +638,7 @@ class TheMotionOfPlanets(Scene):
|
||||
orbit_eccentricies = [0.206, 0.006, 0.0167, 0.0934, 0.967]
|
||||
|
||||
for planet, size in zip(planets, sizes):
|
||||
planet.scale_to_fit_height(0.5)
|
||||
planet.set_height(0.5)
|
||||
planet.scale(size)
|
||||
|
||||
ellipses = VGroup(*[
|
||||
@ -778,7 +778,7 @@ class AskAboutEllipses(TheMotionOfPlanets):
|
||||
)
|
||||
max_width = 0.6 * radial_line.get_width()
|
||||
if new_decimal.get_width() > max_width:
|
||||
new_decimal.scale_to_fit_width(max_width)
|
||||
new_decimal.set_width(max_width)
|
||||
new_decimal.next_to(radial_line, UP, SMALL_BUFF)
|
||||
VGroup(new_decimal, radial_line).rotate(
|
||||
-angle, about_point=ORIGIN
|
||||
@ -888,7 +888,7 @@ class AskAboutEllipses(TheMotionOfPlanets):
|
||||
|
||||
equation = VGroup(d_dt, in_vect, equals, out_vect)
|
||||
equation.arrange_submobjects(RIGHT, buff=SMALL_BUFF)
|
||||
equation.scale_to_fit_width(6)
|
||||
equation.set_width(6)
|
||||
|
||||
equation.to_corner(DR, buff=MED_LARGE_BUFF)
|
||||
cross = Cross(equation)
|
||||
@ -901,7 +901,7 @@ class AskAboutEllipses(TheMotionOfPlanets):
|
||||
# Helpers
|
||||
def get_comet(self):
|
||||
comet = ImageMobject("comet")
|
||||
comet.scale_to_fit_height(self.comet_height)
|
||||
comet.set_height(self.comet_height)
|
||||
return comet
|
||||
|
||||
def get_ellipse(self):
|
||||
@ -1002,7 +1002,7 @@ class FeynmanElementaryQuote(Scene):
|
||||
alignment=""
|
||||
)
|
||||
quote[-1].shift(2 * SMALL_BUFF * LEFT)
|
||||
quote.scale_to_fit_width(FRAME_WIDTH - 1)
|
||||
quote.set_width(FRAME_WIDTH - 1)
|
||||
quote.to_edge(UP)
|
||||
quote.get_part_by_tex("of").set_color(WHITE)
|
||||
|
||||
@ -1038,7 +1038,7 @@ class FeynmanElementaryQuote(Scene):
|
||||
ImageMobject("Fourier_Thumbnail"),
|
||||
)
|
||||
for image in images:
|
||||
image.scale_to_fit_height(3)
|
||||
image.set_height(3)
|
||||
images.arrange_submobjects(RIGHT, buff=LARGE_BUFF)
|
||||
images.to_edge(DOWN, buff=LARGE_BUFF)
|
||||
images[1].move_to(images[0])
|
||||
@ -1075,7 +1075,7 @@ class LostLecturePicture(TODOStub):
|
||||
|
||||
def construct(self):
|
||||
picture = ImageMobject("Feynman_teaching")
|
||||
picture.scale_to_fit_height(FRAME_WIDTH)
|
||||
picture.set_height(FRAME_WIDTH)
|
||||
picture.to_corner(UL, buff=0)
|
||||
picture.fade(0.5)
|
||||
|
||||
@ -1163,7 +1163,7 @@ class DrawEllipseOverlay(Scene):
|
||||
"HeldUpEllipse.jpg"
|
||||
)
|
||||
)
|
||||
image.scale_to_fit_height(FRAME_HEIGHT)
|
||||
image.set_height(FRAME_HEIGHT)
|
||||
|
||||
# self.add(image)
|
||||
self.play(ShowCreation(ellipse))
|
||||
@ -1346,7 +1346,7 @@ class ShowEllipseDefiningProperty(Scene):
|
||||
""",
|
||||
alignment="",
|
||||
)
|
||||
footnote.scale_to_fit_width(5)
|
||||
footnote.set_width(5)
|
||||
footnote.to_corner(DR)
|
||||
footnote.set_stroke(WHITE, 0.5)
|
||||
|
||||
@ -1405,7 +1405,7 @@ class ShowEllipseDefiningProperty(Scene):
|
||||
)
|
||||
max_width = 0.6 * line.get_width()
|
||||
if new_decimal.get_width() > max_width:
|
||||
new_decimal.scale_to_fit_width(max_width)
|
||||
new_decimal.set_width(max_width)
|
||||
new_decimal.next_to(line, UP, SMALL_BUFF)
|
||||
new_decimal.set_color(color)
|
||||
new_decimal.add_to_back(
|
||||
@ -1501,7 +1501,7 @@ class GeometryProofLand(Scene):
|
||||
word.shift(3 * RIGHT)
|
||||
word.apply_complex_function(np.exp)
|
||||
word.rotate(90 * DEGREES)
|
||||
word.scale_to_fit_width(9)
|
||||
word.set_width(9)
|
||||
word.center()
|
||||
word.to_edge(UP)
|
||||
word.set_color_by_gradient(*self.colors)
|
||||
@ -2058,7 +2058,7 @@ class ProveEllipse(ShowEmergingEllipse, ShowEllipseDefiningProperty):
|
||||
ellipse = self.ellipse
|
||||
ep_dot = self.ep_dot
|
||||
planet = ImageMobject("earth")
|
||||
planet.scale_to_fit_height(0.25)
|
||||
planet.set_height(0.25)
|
||||
orbit = Orbiting(planet, ep_dot, ellipse)
|
||||
|
||||
lines = self.lines
|
||||
@ -2323,7 +2323,7 @@ class KeplersSecondLaw(AskAboutEllipses):
|
||||
)
|
||||
min_width = 0.8 * radius.get_length()
|
||||
if radius_words.get_width() > min_width:
|
||||
radius_words.scale_to_fit_width(min_width)
|
||||
radius_words.set_width(min_width)
|
||||
radius_words.match_color(radius)
|
||||
radius_words.next_to(ORIGIN, UP, SMALL_BUFF)
|
||||
angle = radius.get_angle()
|
||||
@ -2378,7 +2378,7 @@ class NonEllipticalKeplersLaw(KeplersSecondLaw):
|
||||
0
|
||||
])
|
||||
)
|
||||
orbit_shape.scale_to_fit_height(7)
|
||||
orbit_shape.set_height(7)
|
||||
orbit_shape.stretch(1.5, 0)
|
||||
orbit_shape.shift(LEFT)
|
||||
orbit_shape.set_stroke(LIGHT_GREY, 1)
|
||||
@ -2736,13 +2736,13 @@ class FeynmanRecountingNewton(Scene):
|
||||
|
||||
def construct(self):
|
||||
feynman_teaching = ImageMobject("Feynman_teaching")
|
||||
feynman_teaching.scale_to_fit_width(FRAME_WIDTH)
|
||||
feynman_teaching.set_width(FRAME_WIDTH)
|
||||
|
||||
newton = ImageMobject("Newton")
|
||||
principia = ImageMobject("Principia_equal_area")
|
||||
images = [newton, principia]
|
||||
for image in images:
|
||||
image.scale_to_fit_height(5)
|
||||
image.set_height(5)
|
||||
newton.to_corner(UL)
|
||||
principia.next_to(newton, RIGHT)
|
||||
for image in images:
|
||||
@ -4197,7 +4197,7 @@ class PatYourselfOnTheBack(TeacherStudentsScene):
|
||||
feynman = ImageMobject("Feynman", height=4)
|
||||
feynman.to_corner(UL)
|
||||
chess = ImageMobject("ChessGameOfTheCentury")
|
||||
chess.scale_to_fit_height(4)
|
||||
chess.set_height(4)
|
||||
chess.next_to(feynman)
|
||||
|
||||
self.play(FadeInFromDown(feynman))
|
||||
@ -4216,7 +4216,7 @@ class Thumbnail(ShowEmergingEllipse):
|
||||
|
||||
def construct(self):
|
||||
background = ImageMobject("Feynman_teaching")
|
||||
background.scale_to_fit_width(FRAME_WIDTH)
|
||||
background.set_width(FRAME_WIDTH)
|
||||
background.scale(1.05)
|
||||
background.to_corner(UR, buff=0)
|
||||
background.shift(2 * UP)
|
||||
@ -4225,7 +4225,7 @@ class Thumbnail(ShowEmergingEllipse):
|
||||
|
||||
circle = self.get_circle()
|
||||
circle.set_stroke(width=6)
|
||||
circle.scale_to_fit_height(6.5)
|
||||
circle.set_height(6.5)
|
||||
circle.to_corner(UL)
|
||||
circle.set_fill(BLACK, 0.9)
|
||||
lines = self.get_lines()
|
||||
|
Reference in New Issue
Block a user