Animate the Fibonacci Sequence & Golden Ratio
Animate the Fibonacci sequence and golden ratio in Manim by drawing nested squares and the spiral they form, with ratios converging to φ ≈ 1.618.
To animate the Fibonacci sequence, draw nested squares whose side lengths are 1, 1, 2, 3, 5, 8, … and connect quarter-circles through them — the result is the famous Fibonacci spiral, and the ratio of consecutive squares visibly approaches the golden ratio . You can hand-code it in Manim or generate it from a prompt with QuantumSketch.
The idea before the code
Fibonacci numbers are defined by , starting . The visual insight is that each new square's side equals the sum of the two before it, so the squares tile a rectangle that keeps the same proportion as it grows. That proportion is the golden ratio. Animation makes the abstract recurrence tangible: you see each square being the sum of the previous two.
Building the squares in Manim
Start by laying down squares of Fibonacci side lengths, placing each new one against the growing rectangle:
from manim import *
class FibonacciSquares(Scene):
def construct(self):
fibs = [1, 1, 2, 3, 5, 8]
squares = VGroup()
for n in fibs:
sq = Square(side_length=n * 0.4)
squares.add(sq)
squares.arrange_in_grid() # replace with spiral placement below
for sq, n in zip(squares, fibs):
label = Text(str(n)).scale(0.5).move_to(sq)
self.play(Create(sq), Write(label), run_time=0.6)
self.wait()
Each self.play(Create(sq)) animates one square appearing, so the viewer follows the sequence one term at a time.
Adding the spiral
The spiral is a chain of quarter-circle arcs, one per square, each turning 90°. Overlaying it on the squares reveals the logarithmic spiral hidden in the tiling:
arc = Arc(radius=n * 0.4, start_angle=PI, angle=-PI / 2)
self.play(Create(arc), run_time=0.5)
Animate the arcs in the same order as the squares and they connect into one continuous curve.
Showing the ratio converge
The payoff is convergence. Display each ratio as a number that updates, and a dashed line at that the values approach: . Watching the ratios oscillate inward toward the golden line is the moment the concept clicks — far more convincing than a static list of numbers.
From prompt to video
Hand-coding Manim is rewarding but slow. QuantumSketch turns a prompt like "animate the Fibonacci spiral and show the ratio approaching the golden ratio" into a narrated video, scripting the storyboard with an LLM and rendering with Manim. If you want to learn the Manim techniques directly, the open-source manim-coding-skill shows the patterns.
Frequently Asked Questions
How do you animate the Fibonacci sequence? Draw squares of side lengths 1, 1, 2, 3, 5, 8 in sequence, then overlay quarter-circle arcs to form the spiral. Animate each square and arc one at a time.
Why does the Fibonacci spiral relate to the golden ratio? Consecutive Fibonacci ratios converge to , so the rectangle the squares tile keeps the golden proportion as it grows.
What tool should I use to animate it? Manim for hand-coded control, or QuantumSketch to generate a narrated version from a prompt.
Is the Fibonacci spiral a true logarithmic spiral? It approximates one. The arc construction is piecewise quarter-circles; a true golden spiral is smooth, but the two are visually nearly identical.
Written by Shihab Shahriar Antor — AI Engineer & Founder of Shahriar Labs. Generate animations like this from a prompt with QuantumSketch; learn the Manim patterns in manim-coding-skill. Also building freelm.