An interactive generative art project that combines traditional mandala patterns with modern AI technology.
- Say "hey mandala" to trigger a greeting animation
- Say color names like "blue", "red" to change colors
- Say "shuffle" or "transform" for random transitions
- Say "stop" to halt the current animation
- Say "background [color]" to change the background
| Key | Action |
|---|---|
| A | Trigger random pattern transition |
| S | Save current image |
| T | Toggle AI assistant input |
| Enter | Send AI request (when input is focused) |
| Esc | Close AI input / dismiss notification |
- Press T or click the ✨ AI Pattern button
- Describe the pattern you want (e.g., "starry night", "ocean waves", "geometric flowers")
- Press Enter or click Generate
- Watch as the mandala transforms based on AI recommendations!
Try these descriptions with the AI:
"starry night"→ spiral arrangement + moon fractal"ocean waves"→ sized arrangement + spiral fractal"geometric flowers"→ hexagon arrangement + flower fractal"rainbow heart"→ sized arrangement + heart fractal"mystical windmill"→ spiral arrangement + windmill fractal
Arrangement controls the layout (16×16 grid):
- Position
[x, y] - Rotation angle
- Size/diameter
Fractal defines the geometric shape:
- Line segments
- Curves and arcs
- Composite shapes
[Origin] ──(0%)──> [Current] ──(100%)──> [Target]
Smooth interpolation between patterns over ~166 frames (1000/60fps).
- Fork this repository
- Import to Vercel
- Add environment variable:
OPENAI_API_KEY=your_key_here - Deploy!
For static hosting without AI features:
- Enable GitHub Pages in repository settings
- Select
mainbranch as source
Mandala/
├── api/recommend.js # Vercel serverless function (AI API)
├── index.html # Main UI
├── sketch.js # Main controller & animation loop
├── arrangement.js # Arrangement class (layout)
├── fractal.js # Fractal class (shapes)
├── presetArrangements.js # Layout presets
├── presetFractals.js # Shape presets
├── basicFunctions.js # Utility functions
└── ARCHITECTURE.md # Detailed documentation
New Arrangement:
- Create function in
presetArrangements.js - Add to
pasAllarray - Update keyword map in
sketch.js
New Fractal:
- Create function in
presetFractals.js - Add to
pfsAllarray - Update keyword map in
sketch.js
Original Project: 2024 ITP Spring Show
Course: The Nature of Code by Daniel Shiffman
Creators:
AI Enhancement: 2026 Update with GPT-4o-mini integration
MIT License - feel free to use and modify!
Have an idea for a new pattern? Share it in Discussions!
