Why "Clover"?
With numPetals = 4, the SWClover curve produces the classic four-leaf clover shape ☘ beloved as a symbol of good luck. With numPetals = 3, it creates the three-lobed club symbol ♣ of a playing card suit. Higher petal counts produce elegant multi-petaled rosettes. All these shapes are epicycloids — curves traced by a point on a small circle rolling around the outside of a fixed circle.
The Parametric Equations
SWClover uses epicycloid parametric equations. For API parameter numPetals, the internal epicycloid parameter n is set to numPetals + 1, and scale factor a = radius / numPetals ensures each petal tip lands exactly radius units from the center:
n = numPetals + 1
a = radius / numPetals
x(t) = a · (n · cos(t) − cos(n · t))
y(t) = a · (n · sin(t) − sin(n · t))
t ∈ [0, 2π)
Special Values of numPetals
| numPetals | n (internal) | Shape |
| 2 | 3 | Nephroid — 2-cusped kidney shape |
| 3 | 4 | 3-petal epicycloid — club ♣ shape |
| 4 | 5 | 4-leaf clover ☘ (default) |
| 5 | 6 | 5-petal rosette |
| 6 | 7 | 6-petal flower |
| 7–8 | 8–9 | Dense multi-petal rosette |
Epicycloids in Mathematics
An epicycloid is traced by a point on the rim of a small circle of radius a rolling around the outside of a fixed circle of radius R. The ratio R/a determines the number of cusps:
- R/a = 1 (n = 2): cardioid (1 cusp)
- R/a = 2 (n = 3): nephroid (2 cusps)
- R/a = 3 (n = 4): 3-cusp epicycloid ♣
- R/a = 4 (n = 5): 4-cusp epicycloid ☘
Famous epicycloid curves appear in gear design (hypocycloidal gears), the Spirograph toy, and the mathematics of complex analysis. The nephroid was first described by Huygens (1678); the term "epicycloid" was introduced by Ole Rømer around 1674 while designing gears.
The Breathe Animation
SWClover's signature animation is Breathe, which oscillates the petal radius sinusoidally — the clover gently expands and contracts like a breathing organism. The Radius display updates in real time. Combine Breathe with Spin and low Background opacity for glowing ghosted trails!
Using the Controls
- Petals — number of clover lobes. 3 = club; 4 = clover; higher = rosette.
- Radius — distance from center to each petal tip in grid units.
- Rotation — rotates the figure. Useful for aligning petals on diagonals.
- Breathe (accordion) — sinusoidally oscillates the radius. Speed sets Hz; Amount sets the radius swing in grid units.
- Spin (accordion) — continuously rotates the clover. Combine with Breathe for complex patterns.
- Drag the center dot to reposition the figure.
- Click the canvas to toggle the grid on/off.
Keyboard Shortcuts
- s — Toggle spin
- b — Toggle breathe
- r — Factory reset
- q — Stop all animations