A community-maintained Python framework for creating mathematical animations.
PatreonEndScreen improvements
Grant Sandersonc95ed9c40599
diff --git a/for_3b1b_videos/common_scenes.py b/for_3b1b_videos/common_scenes.pyindex 820b7d2d4..7b4c51d81 100644--- a/for_3b1b_videos/common_scenes.py+++ b/for_3b1b_videos/common_scenes.py@@ -11,6 +11,7 @@ from animation.creation import DrawBorderThenFillfrom animation.creation import Writefrom animation.creation import FadeInfrom animation.creation import FadeOut+from continual_animation.continual_animation import ContinualMovementfrom mobject.svg.tex_mobject import TextMobjectfrom mobject.types.vectorized_mobject import VGroupfrom scene.scene import Scene@@ -18,12 +19,15 @@ from scene.moving_camera_scene import MovingCameraScenefrom for_3b1b_videos.pi_creature_animations import Blinkfrom for_3b1b_videos.pi_creature import Mortimerfrom for_3b1b_videos.pi_creature import Randolph+from for_3b1b_videos.pi_creature_scene import PiCreatureScenefrom mobject.geometry import Linefrom mobject.geometry import DashedLinefrom mobject.geometry import Rectanglefrom mobject.geometry import Squarefrom mobject.svg.drawings import PatreonLogofrom mobject.svg.drawings import Logo+from utils.space_ops import get_norm+from utils.space_ops import normalizeclass OpeningQuote(Scene):@@ -147,7 +151,7 @@ class PatreonThanks(Scene):last_group = group-class PatreonEndScreen(PatreonThanks):+class PatreonEndScreen(PatreonThanks, PiCreatureScene):CONFIG = {"n_patron_columns": 3,"max_patron_width": 3.5,@@ -155,6 +159,7 @@ class PatreonEndScreen(PatreonThanks):"randomize_order": True,"capitalize": True,"name_y_spacing": 0.7,+ "thanks_words": "Funded by the community, with special thanks to:",}def construct(self):@@ -169,10 +174,10 @@ class PatreonEndScreen(PatreonThanks):for patron in self.specific_patrons]- self.add_title()+ # self.add_title()self.scroll_through_patrons()- def add_title(self):+ def create_pi_creatures(self):title = self.title = TextMobject("Clicky Stuffs")title.scale(1.5)title.to_edge(UP, buff=MED_SMALL_BUFF)@@ -184,6 +189,7 @@ class PatreonEndScreen(PatreonThanks):pi.look(DOWN)pi.next_to(title, vect, buff=MED_LARGE_BUFF)self.add_foreground_mobjects(title, randy, morty)+ return self.pi_creaturesdef scroll_through_patrons(self):logo_box = Square(side_length=2.5)@@ -202,12 +208,13 @@ class PatreonEndScreen(PatreonThanks):line = DashedLine(FRAME_X_RADIUS * LEFT, FRAME_X_RADIUS * RIGHT)line.move_to(ORIGIN)- thanks = TextMobject("Funded by the community, with special thanks to:")+ thanks = TextMobject(self.thanks_words)thanks.scale(0.9)thanks.next_to(black_rect.get_bottom(), UP, SMALL_BUFF)thanks.set_color(YELLOW)underline = Line(LEFT, RIGHT)- underline.set_width(thanks.get_width() + MED_SMALL_BUFF)+ underline.match_width(thanks)+ underline.scale(1.1)underline.next_to(thanks, DOWN, SMALL_BUFF)thanks.add(underline)@@ -233,14 +240,23 @@ class PatreonEndScreen(PatreonThanks):thanks.to_edge(RIGHT)columns.next_to(thanks, DOWN, 3 * LARGE_BUFF)- self.add(columns, black_rect, line, thanks)- self.play(- columns.move_to, 2 * DOWN, DOWN,- columns.align_to, thanks, {"alignment_vect": RIGHT},- rate_func=None,- run_time=self.run_time,+ columns.generate_target()+ columns.target.move_to(2 * DOWN, DOWN)+ columns.target.align_to(+ thanks, alignment_vect=RIGHT+ )+ vect = columns.target.get_center() - columns.get_center()+ distance = get_norm(vect)+ wait_time = 20+ columns_shift = ContinualMovement(+ columns,+ direction=normalize(vect),+ rate=(distance / wait_time))+ self.add(columns_shift, black_rect, line, thanks)+ self.wait(wait_time)+class LogoGenerationTemplate(MovingCameraScene):def setup(self):