This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Animation Patterns Overview
Animation patterns demonstrate fundamental mathematical and algorithmic techniques for creating moving images. These patterns serve as both educational examples and practical templates for generative animations.
Pattern Philosophy
These patterns emphasize:
- Mathematical foundations: Visualizing mathematical concepts
- Algorithmic clarity: Clean, understandable implementations
- Educational value: Learning through visual experimentation
- Practical utility: Reusable techniques for real projects
Pattern List
Plasma Effect
Torch-based plasma effect with color cycling, demonstrating sine wave superposition.
Perlin Noise Fractal
Torch-based Perlin-like noise with varying Gaussian filter for smooth transitions.
Sine Wave Interference
Torch-based wave interference pattern demonstrating constructive and destructive interference.
Mandelbrot Zoom
Mathematical visualization of the Mandelbrot set with zoom animation.
Recursive Pattern
Mathematical recursion creating self-similar patterns through depth-controlled iteration.
flowchart TD
A[Animation Patterns] --> B[Wave-based]
A --> C[Noise-based]
A --> D[Fractal-based]
A --> E[Recursive]
B --> B1[Plasma Effect]
B --> B2[Sine Wave Interference]
C --> C1[Perlin Noise Fractal]
D --> D1[Mandelbrot Zoom]
E --> E1[Recursive Pattern]
B1 --> B11[Sine superposition]
C1 --> C11[Gaussian filter]
D1 --> D11[Complex iteration]
E1 --> E11[Depth recursion]
Technical Concepts
Plasma Effect
Plasma effects demonstrate the superposition principle: combining multiple simple waves creates complex patterns.
Mathematical Foundation:
P(x, y, t) = sin(x + t) + sin(y + t) + sin((x + y)/2 + t)
Key Concepts:
- Wave superposition
- Phase shifts
- Color mapping
- Time-based animation
Perlin Noise Fractal
Perlin noise demonstrates multi-scale signal processing. By smoothing noise at different levels and combining them, you create organic-looking textures.
Key Concepts:
- Gaussian filtering
- Multi-scale analysis
- Signal synthesis
- Dynamic parameters
Sine Wave Interference
Wave interference demonstrates how waves interact constructively and destructively.
Key Concepts:
- Constructive interference (peaks align)
- Destructive interference (peak meets trough)
- Moiré patterns
- Phase relationships
Mandelbrot Zoom
The Mandelbrot set demonstrates complex number iteration and fractal geometry.
Formula:
zₙ₊₁ = zₙ² + c
Key Concepts:
- Complex numbers
- Iteration
- Divergence detection
- Color mapping
Recursive Pattern
Recursive patterns demonstrate mathematical recursion and self-similarity.
Key Concepts:
- Base case
- Recursive step
- Depth control
- Pattern combination
Animation Architecture
Dual-Mode Output
ScriptableImage nodes support both still images and animations through the batch dimension:
- Still image: B=1 (single frame tensor [1,H,W,C])
- Animation: B>1 (batch of frames [B,H,W,C])
This follows ComfyUI's native format and is compatible with SaveWEBM and SaveVideo nodes.
Frame Generation
frames = []
for t in range(num_frames):
frame = generate_frame(t)
frames.append(frame)
output_image = torch.stack(frames, dim=0) # [B, H, W, C]
Performance Considerations
Resolution Trade-offs
- 512×512: Good balance
- 1024×1024: 4× slower, higher quality
- 256×256: 4× faster, good for previews
Frame Count
- 30 frames: Short animations
- 60 frames: 1-second loops
- 600 frames: 10-second loops
Optimization Techniques
- Precompute coordinate grids
- Use vectorized operations
- Limit recursion depth
- Cache intermediate results
Dependencies
Required:
torch: Tensor operationsnumpy: Array manipulationPIL: Image saving
Optional:
scipy: Gaussian filterimageio: Video encodingopencv-python: Alternative encoding
Learning Path
Beginner
- Plasma Effect - Learn sine waves and superposition
- Sine Wave Interference - Understand wave interaction
- Color Cycling - Practice color manipulation
Intermediate
- Perlin Noise Fractal - Learn signal processing
- Scanline Shift - Understand coordinate manipulation
- Gradient Patterns - Practice spatial functions
Advanced
- Mandelbrot Zoom - Complex number iteration
- Recursive Pattern - Mathematical recursion
- Fractal Brownian Motion - Multi-scale synthesis
- Looping Patterns - Mathematical loop design