@@ -47,24 +47,38 @@ def construct(self):
4747 existing_cells = self .create_vector ([1 , 2 , 3 , "" , "" , "" ], colors = [
4848 BLUE , BLUE , BLUE , DARK_GRAY , DARK_GRAY , DARK_GRAY
4949 ])
50- existing_row = VGroup (existing_label , existing_cells ).arrange (RIGHT , buff = 0.5 )
51- existing_row .shift (UP * 1.5 )
5250
5351 # Mask
5452 mask_label = Text ("mask:" , font_size = 24 )
5553 mask_cells = self .create_vector (["F" , "F" , "F" , "T" , "T" , "T" ], colors = [
5654 RED , RED , RED , GREEN , GREEN , GREEN
5755 ])
58- mask_row = VGroup (mask_label , mask_cells ).arrange (RIGHT , buff = 0.5 )
59- mask_row .next_to (existing_row , DOWN , buff = 0.4 )
6056
6157 # Computed result (what would be written)
6258 result_label = Text ("computed:" , font_size = 24 )
6359 result_cells = self .create_vector (["" , "" , "" , 5 , 6 , 7 ], colors = [
6460 DARK_GRAY , DARK_GRAY , DARK_GRAY , YELLOW , YELLOW , YELLOW
6561 ])
66- result_row = VGroup (result_label , result_cells ).arrange (RIGHT , buff = 0.5 )
67- result_row .next_to (mask_row , DOWN , buff = 0.4 )
62+
63+ # Align all labels to the left edge
64+ labels = VGroup (existing_label , mask_label , result_label )
65+ labels .arrange (DOWN , buff = 0.75 , aligned_edge = LEFT )
66+
67+ # Position cells to start at same X coordinate (right of widest label)
68+ existing_cells .next_to (existing_label , RIGHT , buff = 0.5 )
69+ mask_cells .move_to (existing_cells .get_center ())
70+ mask_cells .set_y (mask_label .get_center ()[1 ])
71+ result_cells .move_to (existing_cells .get_center ())
72+ result_cells .set_y (result_label .get_center ()[1 ])
73+
74+ # Create row groups for animation/fadeout
75+ existing_row = VGroup (existing_label , existing_cells )
76+ mask_row = VGroup (mask_label , mask_cells )
77+ result_row = VGroup (result_label , result_cells )
78+
79+ # Group everything and center vertically on screen
80+ all_vectors = VGroup (existing_row , mask_row , result_row )
81+ all_vectors .move_to (ORIGIN )
6882
6983 self .play (Write (existing_row ))
7084 self .wait (0.5 )
@@ -76,8 +90,8 @@ def construct(self):
7690 # Show the two outcomes side by side
7791 self .play (FadeOut (subtitle ))
7892
79- merge_title = Text ("Default (Merge)" , font_size = 28 , color = ORANGE ).shift (LEFT * 3 + DOWN * 0.5 )
80- replace_title = Text ("replace=True" , font_size = 28 , color = PURPLE ).shift (RIGHT * 3 + DOWN * 0.5 )
93+ merge_title = Text ("Default (Merge)" , font_size = 28 , color = ORANGE ).shift (LEFT * 3 + DOWN * 2 )
94+ replace_title = Text ("replace=True" , font_size = 28 , color = PURPLE ).shift (RIGHT * 3 + DOWN * 2 )
8195
8296 with self .voiceover (
8397 """Here's where the two behaviors differ. With default merge behavior,
0 commit comments