A community-maintained Python framework for creating mathematical animations.
added animation steps for brick wall
Ben Hambrecht84c025aac617
diff --git a/active_projects/eop/chapter1/entire_brick_wall.py b/active_projects/eop/chapter1/entire_brick_wall.pyindex 31d07ec1e..f716d7600 100644--- a/active_projects/eop/chapter1/entire_brick_wall.py+++ b/active_projects/eop/chapter1/entire_brick_wall.py@@ -1,29 +1,30 @@from big_ol_pile_of_manim_imports import *from active_projects.eop.reusable_imports import *+from active_projects.eop.chapter1.brick_row_scene import BrickRowScene--class EntireBrickWall(Scene):+class EntireBrickWall(BrickRowScene):def construct(self):+ self.remove(self.get_primary_pi_creature())+row_height = 0.3nb_rows = 20start_point = 3 * UP + 1 * LEFTrows = VMobject()rows.add(BrickRow(0, height = row_height))- rows[0].move_to(start_point)+ rows.move_to(start_point)self.add(rows)-+zero_counter = Integer(0).next_to(start_point + 0.5 * rows[0].width * RIGHT)nb_flips_text = TextMobject("\# of flips")nb_flips_text.next_to(zero_counter, RIGHT, buff = LARGE_BUFF)self.add(zero_counter, nb_flips_text)- for i in range(1,nb_rows + 1):- rows.add(BrickRow(i, height = row_height))- rows[-1].move_to(start_point + (i - 1) * row_height * DOWN)+ for i in range(1, nb_rows + 1):+ rows.add(rows[-1].copy())self.bring_to_back(rows[-1])anims = [rows[-1].shift, row_height * DOWN,@@ -37,6 +38,12 @@ class EntireBrickWall(Scene):self.play(*anims)+ self.play(SplitRectsInBrickWall(rows[-1]))+ rows.submobjects[-1] = self.merge_rects_by_subdiv(rows[-1])+ rows.submobjects[-1] = self.merge_rects_by_coloring(rows[-1])+++# draw indices under the last row for the number of tailstails_counters = VGroup()for (i, rect) in enumerate(rows[-1].rects):@@ -62,6 +69,12 @@ class EntireBrickWall(Scene):FadeIn(nb_tails_text))+ # remove any hidden brick rows+ hidden_brick_rows = VGroup(*[mob for mob in self.mobjects+ if isinstance(mob, BrickRow) and not mob in rows+ ])+ self.remove(hidden_brick_rows)+special_brick_copy = rows[-1].rects[13].copy()self.play(rows.fade, 0.9,diff --git a/active_projects/eop/reusables/brick_row.py b/active_projects/eop/reusables/brick_row.pyindex 92ca15f79..875d8920d 100644--- a/active_projects/eop/reusables/brick_row.py+++ b/active_projects/eop/reusables/brick_row.py@@ -184,6 +184,7 @@ class SplitRectsInBrickWall(AnimationGroup):def __init__(self, mobject, **kwargs):+ #print mobject.height, mobject.get_height()r = self.subdiv_level = mobject.subdiv_level + 1subdivs = VGroup()@@ -196,6 +197,7 @@ class SplitRectsInBrickWall(AnimationGroup):subdiv = DashedLine(mobject.get_top() + x * RIGHT,mobject.get_bottom() + x * RIGHT,+ dashed_segment_length = 0.02)subdivs.add(subdiv)anims.append(ShowCreation(subdiv))