An identity with braces and arrows

An identity is easier to follow when the picture says what its parts are. You will take a² − b² = (a − b)(a + b) and put a labelled brace under each side and an arrow that arcs from one side to the other, then play it and export it.

What you will make

An eleven-second scene. The identity writes itself in; a blue brace grows under the left side and its label fades in; a green brace and its label follow under the right side; last, an arrow is drawn over the equals sign from the left side to the right one.

This is the same scene as ManimCE renders it from the Python the editor exports:

Along the way you meet the Alt pick of glyphs, the brace of the glyph bar, a label typed in the editor, the compass of an arrow, an arc and GrowArrow.

Before you start

You need the basics of the Preview and of the timeline, and to have added a formula to a project once (Your first animation). Download the starting project and open it: choose File ▸ Open…, press Other file… in the Projects dialog and pick the downloaded file (Opening a project). It holds the identity on the timeline, written in over 1.8 seconds, and nothing else.

The identity has sixteen glyphs. The left side is the first five (a, 2, −, b, 2), then comes the equals sign, and the right side is the last ten, from the first parenthesis to the last.

Step by step

1. A brace under the left side

Click the ruler of the timeline to put the playhead at about 2.6 s (the time is read beside the transport buttons): the brace will start where the playhead is. In the Preview, Alt+click the first glyph of the left side, then Alt+Shift+click its last: the five glyphs are picked. The bar at the corner of the Preview says so. Open Brace ▾ and choose Below.

The identity with the five glyphs of its left side picked in yellow, the bar of the Preview that says so, and the menu Brace listing Below, Above, Left, Right and On some glyphs.
Five glyphs picked; Brace ▾ offers the four sides.

The brace has its own clip on a track above the identity's, from 2.6 s to the end. Braces has all the ways to add one.

2. Colour it

Right-click the brace. Colour ▸ offers the Manim colours as swatches: choose the blue one (its tooltip says BLUE).

The menu of the brace with its Colour submenu open: the Manim colours as swatches, then a field for any other colour.
The menu of the brace, with Colour ▸ open.

3. Give it a label

Right-click the brace again and choose Add label ▸ Formula. An empty formula hangs at the brace's tip and its editor opens. Click the Raw LaTeX box, type \text{difference of squares}, press Apply and close the editor.

The editor of the label, a dialog named Formula f2: the raw LaTeX text of difference of squares typed, and the glyphs of the label shown on its right.
The label is typed as raw LaTeX in the editor, then applied.

4. Make it grow

Right-click the brace once more. Intro ▸ gives it the animation its clip starts with: choose GrowFromCenter. The label fades in with the brace.

The menu of the brace with its Intro submenu open: None, Write, FadeIn, GrowFromCenter, DrawBorderThenFill and Create.
The menu of the brace, with Intro ▸ open.

5. The same on the right

Move the playhead to 4.4 s. Alt+click the first parenthesis of the right side and Alt+Shift+click the last. Choose Brace ▾ ▸ Below, then in its menu Colour ▸ the green swatch, a label \text{a product} and Intro ▸ GrowFromCenter.

6. An arrow over the equals sign

Move the playhead to 6.4 s. Pick the whole left side again, as in step 1. Right-click the equals sign, which is not picked: the menu of the clip opens. Choose Add line ▸ Arrow. The arrow starts on the glyphs you picked, and a compass asks where on them: choose the top edge, the arrow pointing up.

Now say where it ends. Hold Alt and drag a rectangle over the ten glyphs of the right side: the end goes on all of them. The compass asks again: choose the top edge.

The identity with its left side picked in yellow and the menu of the equals sign open: the entry Add line with its submenu Line, Dashed line, Arrow and Double arrow.
With the left side picked, right-click the equals sign: Add line ▸ Arrow.
The identity with the ten glyphs of its right side picked in yellow, and the compass that asks where on them the end of the arrow goes.
The Alt drag has picked the right side: the compass asks where on it the arrow ends.

The compass and the other ways to move an end are in Lines and arrows.

7. Bend it

Right-click the arrow and choose Curve ▸ Arc. In the Line section of the Animations panel (the Timing tab) set Arc to −55. A negative number bulges an arrow that points right upwards.

The Preview with the identity and an arrow arcing over it, and the Line section of the Animations panel with Curve set to arc and the Arc field at −55.
The arrow arcs over the equals sign; its Arc field (1) says −55.

8. Draw it in

In the Intro section choose the animation GrowArrow and make it 1.4 seconds long. An arrow that is bent is drawn along its curve, with its tip on the end of what is drawn.

The Intro section of the Animations panel for the arrow: the animation GrowArrow (1) and its duration of 1.4 seconds (2).
The animation (1) and its length (2).

9. Play it

Press Space, or go to the start with Home and play. The braces grow at 2.6 and 4.4 seconds and the arrow is drawn at 6.4. Everything stays to the end at 11 seconds. If a label starts at the wrong time, drag its clip on the timeline, or type its Start in the panel.

10. Export it

Export ▸ Python — ManimCE… gives the scene as a .py file, and Export ▸ Video… renders a video (Exporting). The player above and the video were made from the finished project that you can download in the card.

The result

The Python of the finished scene, for ManimCE and ManimGL:

A few lines tell the story. The two braces are built on the glyphs they hang on and their labels are put at their tips; the arrow is built between the top of the left side and the top of the right side, bent by path_arc, and drawn in with the editor's own trace animation because it is bent.

Make it your own