mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Merge branch 'master' into eop
This commit is contained in:
commit
7ed7d96f6f
5 changed files with 1945 additions and 115 deletions
File diff suppressed because it is too large
Load diff
|
@ -144,14 +144,10 @@ class FadeIn(Transform):
|
|||
|
||||
|
||||
class FadeInAndShiftFromDirection(Transform):
|
||||
CONFIG = {
|
||||
"direction": DOWN,
|
||||
}
|
||||
|
||||
def __init__(self, mobject, **kwargs):
|
||||
def __init__(self, mobject, direction=DOWN, **kwargs):
|
||||
digest_config(self, kwargs)
|
||||
target = mobject.copy()
|
||||
mobject.shift(self.direction)
|
||||
mobject.shift(direction)
|
||||
mobject.fade(1)
|
||||
Transform.__init__(self, mobject, target, **kwargs)
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from __future__ import absolute_import
|
||||
|
||||
import random
|
||||
import string
|
||||
|
||||
from constants import *
|
||||
|
||||
|
@ -99,7 +100,6 @@ class PatreonThanks(Scene):
|
|||
patreon_logo = PatreonLogo()
|
||||
patreon_logo.to_edge(UP)
|
||||
|
||||
n_patrons = len(self.specific_patrons)
|
||||
patrons = map(TextMobject, self.specific_patrons)
|
||||
num_groups = float(len(patrons)) / self.max_patron_group_size
|
||||
proportion_range = np.linspace(0, 1, num_groups + 1)
|
||||
|
@ -147,14 +147,22 @@ class PatreonThanks(Scene):
|
|||
class PatreonEndScreen(PatreonThanks):
|
||||
CONFIG = {
|
||||
"n_patron_columns": 3,
|
||||
"max_patron_width": 3,
|
||||
"max_patron_width": 3.5,
|
||||
"run_time": 20,
|
||||
"randomize_order": True,
|
||||
"capitalize": True,
|
||||
"name_y_spacing": 0.7,
|
||||
}
|
||||
|
||||
def construct(self):
|
||||
if self.randomize_order:
|
||||
random.shuffle(self.specific_patrons)
|
||||
if self.capitalize:
|
||||
self.specific_patrons = [
|
||||
" ".join(map(string.capitalize, patron.split(" ")))
|
||||
for patron in self.specific_patrons
|
||||
]
|
||||
|
||||
self.add_title()
|
||||
self.scroll_through_patrons()
|
||||
|
||||
|
@ -195,11 +203,12 @@ class PatreonEndScreen(PatreonThanks):
|
|||
if patron.get_width() > self.max_patron_width:
|
||||
patron.scale_to_fit_width(self.max_patron_width)
|
||||
columns = VGroup(*[
|
||||
VGroup(
|
||||
*patrons[i::self.n_patron_columns]
|
||||
).arrange_submobjects(DOWN, buff=MED_SMALL_BUFF)
|
||||
VGroup(*patrons[i::self.n_patron_columns])
|
||||
for i in range(self.n_patron_columns)
|
||||
])
|
||||
for column in columns:
|
||||
for n, name in enumerate(column):
|
||||
name.shift(n * self.name_y_spacing * DOWN)
|
||||
columns.arrange_submobjects(
|
||||
RIGHT, buff=LARGE_BUFF,
|
||||
aligned_edge=UP,
|
||||
|
@ -209,7 +218,7 @@ class PatreonEndScreen(PatreonThanks):
|
|||
columns.to_edge(RIGHT)
|
||||
|
||||
self.play(
|
||||
columns.next_to, FRAME_Y_RADIUS * DOWN, UP, LARGE_BUFF,
|
||||
columns.move_to, 2 * DOWN, DOWN,
|
||||
columns.to_edge, RIGHT,
|
||||
Animation(black_rect),
|
||||
rate_func=None,
|
||||
|
|
|
@ -262,8 +262,7 @@ class TeacherStudentsScene(PiCreatureScene):
|
|||
PiCreatureScene.setup(self)
|
||||
self.screen = ScreenRectangle(height=self.screen_height)
|
||||
self.screen.to_corner(UP + LEFT)
|
||||
self.hold_up_spot = self.teacher.get_corner(
|
||||
UP + LEFT) + MED_LARGE_BUFF * UP
|
||||
self.hold_up_spot = self.teacher.get_corner(UP + LEFT) + MED_LARGE_BUFF * UP
|
||||
|
||||
def create_pi_creatures(self):
|
||||
self.teacher = Mortimer(color = self.default_pi_creature_kwargs["color"])
|
||||
|
|
|
@ -72,8 +72,8 @@ class ImageMobject(Mobject):
|
|||
DOWN + LEFT,
|
||||
])
|
||||
self.center()
|
||||
self.scale_to_fit_height(self.height)
|
||||
h, w = self.pixel_array.shape[:2]
|
||||
self.stretch_to_fit_height(self.height)
|
||||
self.stretch_to_fit_width(self.height * w / h)
|
||||
|
||||
def set_opacity(self, alpha):
|
||||
|
|
Loading…
Add table
Reference in a new issue