mirror of
https://github.com/3b1b/videos.git
synced 2025-09-18 21:38:53 +00:00
Thumbnail updates
This commit is contained in:
parent
a187a409fa
commit
55003049f8
2 changed files with 60 additions and 8 deletions
40
_2017/mug.py
40
_2017/mug.py
|
@ -2,7 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from manim_imports_ext import *
|
||||
from _2017.efvgt import ConfettiSpiril
|
||||
# from _2017.efvgt import ConfettiSpiril
|
||||
|
||||
#revert_to_original_skipping_status
|
||||
|
||||
|
@ -84,6 +84,7 @@ class UtilitiesPuzzleScene(Scene):
|
|||
houses = VGroup()
|
||||
for x in range(3):
|
||||
house = SVGMobject(file_name = "house")
|
||||
house.set_stroke(BLACK, 5, background=True)
|
||||
house.set_height(self.object_height)
|
||||
house.set_fill(GREY_B)
|
||||
house.move_to(x*self.h_distance*RIGHT)
|
||||
|
@ -106,10 +107,12 @@ class UtilitiesPuzzleScene(Scene):
|
|||
stroke_width = 0
|
||||
)
|
||||
objects.add(bounding_box)
|
||||
self.add_foreground_mobjects(objects)
|
||||
self.set_variables_as_attrs(
|
||||
houses, utilities, objects, bounding_box
|
||||
)
|
||||
self.add(objects)
|
||||
self.houses = houses
|
||||
self.utilities = utilities
|
||||
self.objects = objects
|
||||
self.bounding_box = bounding_box
|
||||
|
||||
|
||||
def get_utility(self, name, color):
|
||||
circle = Circle(
|
||||
|
@ -122,6 +125,8 @@ class UtilitiesPuzzleScene(Scene):
|
|||
height = 0.65*circle.get_height(),
|
||||
fill_color = WHITE,
|
||||
)
|
||||
utility.insert_n_curves(100)
|
||||
utility.set_stroke(width=0)
|
||||
if color == YELLOW:
|
||||
utility.set_fill(GREY_D)
|
||||
utility.move_to(circle)
|
||||
|
@ -2065,3 +2070,28 @@ class NewMugThumbnail(Scene):
|
|||
image.next_to(title, DOWN)
|
||||
self.add(title, image)
|
||||
|
||||
class Thumbnail3(UtilitiesPuzzleScene):
|
||||
def construct(self):
|
||||
self.setup_configuration()
|
||||
lines = self.get_almost_solution_lines()
|
||||
lines.set_stroke(WHITE, 5, opacity=0.9)
|
||||
|
||||
group = VGroup(lines, self.objects)
|
||||
group.set_height(5.5)
|
||||
group.to_edge(DOWN, buff=0.1)
|
||||
|
||||
self.add(*group)
|
||||
|
||||
words = TexText("No crossing\\\\allowed!", font_size=72)
|
||||
words.to_corner(UL)
|
||||
# words.shift(3 * RIGHT)
|
||||
arrow = Arrow(
|
||||
words.get_corner(UR) + 0.1 * DOWN,
|
||||
group.get_top() + 0.35 * DOWN + 0.15 * RIGHT,
|
||||
path_arc=-75 * DEGREES,
|
||||
thickness=0.1,
|
||||
)
|
||||
arrow.set_fill(RED)
|
||||
|
||||
self.add(words, arrow)
|
||||
|
||||
|
|
|
@ -97,15 +97,37 @@ class Thumbnail(Scene):
|
|||
grid.set_opacity(0.5)
|
||||
self.add(grid)
|
||||
|
||||
mat_mob = IntegerMatrix([[3, 1], [4, 1]])
|
||||
mat_mob = IntegerMatrix([[3, 1], [4, 3]], h_buff=0.8)
|
||||
mat_mob.set_height(3)
|
||||
mat_mob.add_to_back(BackgroundRectangle(mat_mob))
|
||||
mat_mob.to_edge(UP, buff=MED_SMALL_BUFF)
|
||||
self.add(mat_mob)
|
||||
|
||||
answer = Tex("{m} \\pm \\sqrt{\\,{m}^2 - {p}", tex_to_color_map={"{m}": MEAN_COLOR, "{p}": PROD_COLOR})
|
||||
a, b, c, d = mat_mob.get_entries()
|
||||
a_to_d = d.get_center() - a.get_center()
|
||||
rect = Rectangle(height=1, width=get_norm(a_to_d) + 1)
|
||||
rect.round_corners()
|
||||
rect.set_stroke(MEAN_COLOR, 3)
|
||||
rect.rotate(angle_of_vector(a_to_d))
|
||||
rect.move_to(VGroup(a, d))
|
||||
rect2 = rect.copy()
|
||||
rect2.set_color(PROD_COLOR)
|
||||
rect2.rotate(-2 * angle_of_vector(a_to_d))
|
||||
rect2.move_to(rect)
|
||||
|
||||
dashed_rects = VGroup(
|
||||
DashedVMobject(rect.insert_n_curves(100), num_dashes=50),
|
||||
DashedVMobject(rect2.insert_n_curves(100), num_dashes=50),
|
||||
)
|
||||
|
||||
self.add(dashed_rects)
|
||||
|
||||
answer = Tex(
|
||||
"\\lambda_1, \\lambda_2 = {3} \\pm \\sqrt{\\,{3}^2 - {5}} = 5, 1",
|
||||
tex_to_color_map={"{3}": MEAN_COLOR, "{p}": PROD_COLOR}
|
||||
)
|
||||
answer.add_background_rectangle()
|
||||
answer.set_width(FRAME_WIDTH / 2 + 2)
|
||||
answer.set_width(12)
|
||||
answer.to_edge(DOWN)
|
||||
# answer.shift(SMALL_BUFF * UP)
|
||||
self.add(answer)
|
||||
|
|
Loading…
Add table
Reference in a new issue