Circle to Square to Triangle Morph with Color Fade
Loading...
Loading video...
Pro
0:00 / 0:00
Purpose: Demonstrate shape morphing and color interpolation using Manim.
1. Scene Overview
- Scene Class:
ShapeMorphScene(inherits fromScene). - Background Color: White (
WHITE). - Camera: Default 2‑D camera, no movement.
2. Visual Elements
| Element | Description | Parameters |
|---|---|---|
| Circle | Blue circle, centered at the origin. | Radius r = 2; Fill color BLUE; Stroke color BLUE |
| Square | Morph target after the circle. | Side length s = 2*sqrt(2) ≈ 2.828; Fill color will transition; Stroke color matches fill |
| Triangle | Final morph target (equilateral, pointing upward). | Side length a = 2*sqrt(3) ≈ 3.464; Vertices positioned so the shape stays centered; Fill color continues transition |
3. Timing & Transitions
- Total Duration: 8 seconds.
- Morph 1 (Circle → Square): 3 seconds.
- Morph 2 (Square → Triangle): 3 seconds.
- Hold on Triangle: 2 seconds (static display).
- Easing: Linear interpolation for both shape and color.
- Color Transition: Continuous interpolation from
BLUEtoREDover the entire 6‑second morph period.
4. Animation Steps (Pseudo‑code)
class ShapeMorphScene(Scene):
def construct(self):
# Create initial circle
circle = Circle(radius=2, color=BLUE, fill_opacity=1).move_to(ORIGIN)
self.add(circle)
# Define target square and triangle
square = Square(side_length=2*sqrt(2), color=RED, fill_opacity=1).move_to(ORIGIN)
triangle = RegularPolygon(n=3, side_length=2*sqrt(3), color=RED, fill_opacity=1).move_to(ORIGIN)
# Morph circle -> square with continuous color change
self.play(
Transform(circle, square, run_time=3, rate_func=linear),
circle.animate.set_color(interpolate_color(BLUE, RED, 0.5)),
)
# Morph square -> triangle with continued color change
self.play(
Transform(square, triangle, run_time=3, rate_func=linear),
square.animate.set_color(interpolate_color(BLUE, RED, 1.0)),
)
# Hold on final triangle
self.wait(2)
5. Mathematical Details
- Area Equality (approximate):
- Color Interpolation: Linear blend between RGB values of
BLUE(0,0,1)andRED(1,0,0).
6. Default Assumptions Used
- All shapes are centered at the origin.
- No additional background or foreground objects.
- Linear easing for smooth, predictable morphing.
- The animation ends after the final hold; no looping.
- The scene uses the default resolution and frame rate of Manim (default 1080p, 30 fps).
Created By
Description
The scene shows a blue circle morphing linearly into a square and then into an upward-pointing equilateral triangle, while the fill color transitions smoothly from blue to red over six seconds, followed by a two-second hold on the final triangle.
Created At
Dec 25, 2025, 02:55 PM
Tags
shape-morphingcolor-interpolationgeometry
Status
Completed