GuideGuides4 sections
Objects And Layout
Readable scripts come from deliberate layout. This page covers the helpers that keep scenes stable and easy to adjust: move_to, next_to, align_to, arrange, arrange_in_grid, grouping, and styling.
Positioning Helpers
move_to()places an object at an explicit target point.next_to()places one object relative to another.align_to()lines up one edge or axis against another object.to_edge()andto_corner()place frame-relative labels and overlays.
Arrangement Helpers
For multi-object layouts, prefer grouped arrangement over repeated manual shifts.
header = Text("Group layout helpers", font_size=30, color=WHITE) top_row = VGroup( Circle(radius=0.34), Square(side_length=0.68), Triangle().scale(0.45),).arrange(RIGHT, buff=0.6, aligned_edge=DOWN) grid_items = VGroup( Dot(color=BLUE).scale(1.2), Square(side_length=0.5, color=GREEN), Triangle(color=YELLOW).scale(0.45),).arrange_in_grid(rows=1, cols=3, buff=(0.4, 0.45)) layout = VGroup(header, top_row, grid_items).arrange(DOWN, aligned_edge=LEFT, buff=0.48)layout.move_to(ORIGIN) Styling
set_stroke()controls outline color and width.set_fill()controls fill color and opacity.- Consistent styling across grouped objects usually reads better than per-object improvisation.
Text And Math
Text, Tex, and MathTex belong in the same layout system as every other mobject. Compose them with alignment and group helpers instead of treating them as a separate special case.