Originally written as internal engineering notes while building the thing it describes. Republished here with light editing โ the timeframe is noted where it matters.
This document describes the new features inspired by the capsule-render project and how they've been integrated into Chromaflow โ the SVG banner generator I maintain, published as gradient-svg-generator and running at gradient-svg-generator.vercel.app.
๐ Project Analysis#
The capsule-render project is a GitHub profile decoration tool that generates SVG banners with text and animated backgrounds. We analyzed 13 different background types and extracted valuable techniques that complement our existing gradient system.
๐จ New Features Implemented#
1. Text Animation System โจ#
Inspired by capsule-render's text animation capabilities, we've added 5 CSS-based animation types:
Available Animations#
-
fadeIn- Smooth opacity fade (1.2s)/api/svg?text=Hello&animation=fadeIn -
scaleIn- Scale from 0 to 1 (0.8s)/api/svg?text=Hello&animation=scaleIn -
blink- Quick on/off pattern (0.6s, plays once)/api/svg?text=Hello&animation=blink -
blinking- Continuous on/off (1.6s infinite loop)/api/svg?text=Hello&animation=blinking -
twinkling- Soft opacity pulsing (4s infinite loop)/api/svg?text=Hello&animation=twinkling
Implementation Details#
- File:
src/utils/textAnimationUtils.js - Integration: Automatically applied to all gradient types
- Compatibility: Works with existing templates and gradients
- Default: No animation (use
animation=noneor omit parameter)
Code Example#
// Using with any gradient type
/api/svg?text=Welcome&gradientType=radial&animation=fadeIn
// Using with templates
/api/svg?text=Hello&template=neural-network&animation=twinkling2. Blob Morphing Gradients ๐#
Inspired by capsule-render's Venom effect, these create organic, liquid-like shapes that continuously morph between different forms.
Gradient Types#
-
blobMorph- Basic organic blob morphing- Duration: 10s cycle
- 3-4 shape states
- Smooth spline transitions
/api/svg?text=Venom&gradientType=blobMorph -
liquidBlob- Multi-layer blob with depth- Duration: 12s cycle
- 2 overlapping layers with staggered timing
- Blur filters for atmospheric effect
/api/svg?text=Mercury&gradientType=liquidBlob -
organicBlob- Radial blob with glow- Duration: 15s cycle
- 5 complex shape variations
- Radial gradient with glow filter
/api/svg?text=Plasma&gradientType=organicBlob
Templates Using Blob Morphing#
liquid-venom- Purple/pink liquid morphingmercury-flow- Metallic silver bloborganic-plasma- Warm red/pink plasmamorphing-ocean- Ocean blue liquidsunset-blob- Warm sunset colorsneon-pulse- Vibrant neon morphingfire-morph- Fiery liquid effect
Implementation Details#
- File:
src/utils/gradientGenerators/blobMorphingGradients.js - Technique: SVG path morphing with
<animate>ondattribute - Path Generation: Algorithmic blob path creation with randomization
- Performance: Optimized with spline interpolation
3. Layered Wave Gradients ๐#
Inspired by capsule-render's Waving effect, creates oceanic depth with multiple semi-transparent wave layers.
Gradient Type#
layeredWaves - Multi-layer depth effect
- 3 independent wave layers
- Staggered animations (begins at 0s, -0.5s, -1s)
- Opacity layering (0.3, 0.4, 0.5)
- Blur filter for atmospheric depth
/api/svg?text=Ocean&gradientType=layeredWaves
Templates Using Layered Waves#
ocean-depths- Deep ocean blues (12s)aurora-waves- Northern lights colors (15s)cosmic-waves- Deep space purples (18s)
Key Features#
- Depth Effect: Multiple opacity layers create 3D illusion
- Smooth Motion: Spline-based keyframe animation
- Organic Feel: Quadratic Bezier curves for natural waves
- Performance: CSS transforms for smooth 60fps animation
Implementation Details#
- File: Enhanced
src/utils/gradientGenerators/shapeGradients.js - Wave Paths: SVG path with T (smooth quadratic curve) commands
- Animation: Morphs between 4 different wave states
- Timing: Independent timing for each layer prevents repetition
4. Blur Motion Gradients ๐ซ#
Inspired by capsule-render's Blur effect, creates abstract, dreamy atmospheres with soft floating circles.
Gradient Types#
-
blurMotion- Soft floating circles- 3 circles with heavy blur (stdDeviation="12")
- Independent X/Y animations
- Duration: 12s
/api/svg?text=Dream&gradientType=blurMotion -
dreamyCircles- Multiple dreamy circles- 4 circles with varied sizes and opacity
- Staggered begin times (0s, 0.5s, 1s, 1.5s)
- Duration: 15s
/api/svg?text=Fantasy&gradientType=dreamyCircles -
abstractBlur- Minimalist abstract- 3 circles with maximum blur (stdDeviation="15")
- Radial gradients with saturation boost
- Duration: 20s
/api/svg?text=Zen&gradientType=abstractBlur
Templates Using Blur Motion#
dreamy-sunset- Warm sunset blur (12s)pastel-dream- Soft pastel circles (15s)abstract-night- Dark abstract blur (20s)ethereal-mist- Lavender mist (18s)soft-lavender- Gentle lavender (16s)
Key Features#
- Heavy Blur: Gaussian blur with stdDeviation 8-15
- Opacity Layering: Ranges from 0.15 to 0.4
- Independent Motion: Each circle has unique X/Y animation
- Color Saturation: Filters boost saturation 1.4-1.6x
Implementation Details#
- File:
src/utils/gradientGenerators/blurMotionGradients.js - Filters:
feGaussianBlur+feColorMatrix - Animation: Spline-based easing with keySplines="0.4 0 0.6 1"
- Performance: Filter caching for better performance
๐ API Usage Examples#
Combining Features#
# Text animation + Blob morphing
/api/svg?text=Morphing&gradientType=blobMorph&animation=fadeIn
# Layered waves + Twinkling text
/api/svg?text=Ocean&gradientType=layeredWaves&animation=twinkling
# Blur motion + Scale animation
/api/svg?text=Dream&gradientType=dreamyCircles&animation=scaleIn
# Template + Text animation
/api/svg?text=Venom&template=liquid-venom&animation=blinkingCustom Heights#
# Tall morphing effect
/api/svg?text=Tall&gradientType=blobMorph&height=200
# Wide blur effect
/api/svg?text=Wide&gradientType=blurMotion&height=150With Custom Colors#
# Custom colors with blob morphing
/api/svg?text=Custom&gradientType=liquidBlob&color0=FF0000&color1=00FF00&color2=0000FF๐ฏ Template Reference#
All New Templates (15 total)#
Blob Morphing (6 templates)#
liquid-venom- Purple/pink liquidmercury-flow- Metallic silverorganic-plasma- Red/pink plasmamorphing-ocean- Ocean bluesunset-blob- Warm sunsetneon-pulse- Vibrant neonfire-morph- Fiery liquid
Layered Waves (3 templates)#
ocean-depths- Deep oceanaurora-waves- Northern lightscosmic-waves- Deep space
Blur Motion (5 templates)#
dreamy-sunset- Sunset blurpastel-dream- Pastel circlesabstract-night- Dark abstractethereal-mist- Lavender mistsoft-lavender- Gentle lavender
๐ง Technical Implementation#
Architecture#
src/
โโโ utils/
โ โโโ textAnimationUtils.js # Text animation CSS generator
โ โโโ gradientGenerators/
โ โโโ blobMorphingGradients.js # Blob morphing effects
โ โโโ blurMotionGradients.js # Blur motion effects
โ โโโ shapeGradients.js # Enhanced with layeredWaves
โโโ templates/
โ โโโ capsuleShapeTemplates.js # 15 new templates
โโโ config/
โโโ gradientConfig.js # Updated with new types
Key Techniques Learned#
-
SVG Path Morphing
- Animate the
dattribute of<path>elements - Use matching number of path commands for smooth transitions
- Spline interpolation for organic motion
- Animate the
-
Multi-Layer Animation
- Stagger animation begin times for depth
- Use opacity layers (0.3, 0.4, 0.5)
- Independent timing per layer
-
Heavy Blur Filters
feGaussianBlurwith stdDeviation 8-15- Combine with
feColorMatrixfor saturation - Cache filters for performance
-
CSS Text Animations
- Keyframe-based animations
- Spline easing for smooth motion
- Transform-origin for proper scaling
๐ Performance Considerations#
Optimizations Applied#
-
Animation Efficiency
- CSS transforms over position changes
- GPU-accelerated properties (transform, opacity)
- Reduced animation complexity for mobile
-
Filter Caching
- Reusable filter definitions
- Unique IDs prevent conflicts
- Minimal filter chains
-
Path Optimization
- Algorithmic path generation
- Reduced number of path points
- Smooth curve commands (T, Q) over line segments
Browser Compatibility#
- โ Chrome/Edge: Full support
- โ Firefox: Full support
- โ Safari: Full support
- โ Mobile browsers: Optimized performance
๐ References#
- Original Project: capsule-render
- Techniques Inspired By:
- Venom effect โ Blob Morphing
- Waving effect โ Layered Waves
- Blur effect โ Blur Motion
- Text animations โ Text Animation System
๐ Learning Outcomes#
Design Insights#
- Layering Creates Depth: Multiple semi-transparent layers with staggered animations create perceived 3D depth
- Blur Adds Atmosphere: Heavy Gaussian blur transforms simple shapes into atmospheric effects
- Organic Motion: Path morphing with spline interpolation feels more natural than linear transforms
- Subtlety Matters: Low opacity (0.15-0.4) and slow animations (12-20s) create sophisticated effects
Technical Insights#
- SVG Path Animation: The
dattribute can be animated for shape morphing - Filter Composition: Combining multiple SVG filters creates complex visual effects
- Animation Timing: Staggered begin times prevent visual repetition
- Performance: CSS animations perform better than JavaScript-based animations
๐จ Additional Features Implemented#
5. Text Effect Enhancements โจ#
Building on capsule-render's text customization capabilities, we've added comprehensive text styling options.
Text Stroke Effects#
Add outlined text with customizable stroke colors and widths:
# Basic stroke
/api/svg?text=Hello&stroke=FF0000&strokeWidth=2
# Stroke with gradient background
/api/svg?text=Outlined&template=neural-network&stroke=FFFF00&strokeWidth=3
# Combine with animations
/api/svg?text=Glowing&animation=twinkling&stroke=00FFFF&strokeWidth=1.5Parameters:
stroke- Hex color for text outline (without #)strokeWidth- Width in pixels (0-10 recommended)
Text Background Rectangles#
Add highlighted background boxes behind text:
# Basic background
/api/svg?text=Important&textBg=FF0000
# Semi-transparent background
/api/svg?text=Notice&textBg=FFD700&template=dreamy-sunset
# Combine with stroke
/api/svg?text=Alert&textBg=FF4444&stroke=FFFFFF&strokeWidth=2Parameters:
textBg- Hex color for background rectangle (without #)- Automatically sized based on text length
- 25px border radius for rounded corners
- 0.9 opacity for subtle effect
Text Rotation#
Rotate text at any angle:
# 45-degree angle
/api/svg?text=Diagonal&rotate=45
# Upside down
/api/svg?text=Inverted&rotate=180
# Slight tilt
/api/svg?text=Dynamic&rotate=15&template=cyber-capsuleParameters:
rotate- Rotation angle in degrees (-360 to 360)- Rotates around text center point
Combined Text Effects#
All text effects can be combined for rich styling:
# Full styling
/api/svg?text=FEATURED&stroke=FFD700&strokeWidth=2&textBg=000000&rotate=5&animation=scaleIn
# Retro gaming style
/api/svg?text=LEVEL_UP&template=pixel-art-retro&stroke=FFFFFF&strokeWidth=3&textBg=FF00FF
# Modern UI callout
/api/svg?text=NEW&textBg=FF3B30&stroke=FFFFFF&strokeWidth=1&animation=fadeIn6. Shape Background Templates ๐ท#
Inspired by capsule-render's diverse shape types, we've implemented 7 unique shaped backgrounds beyond standard rectangles.
Available Shape Types#
-
cylinder- Capsule/pill shape with rounded ends/api/svg?text=Capsule&gradientType=cylinder -
softRounded- Subtle rounded corners (15px radius)/api/svg?text=Modern&gradientType=softRounded -
eggShape- Organic oval/egg form/api/svg?text=Organic&gradientType=eggShape -
sliceShape- Diagonal angular cut/api/svg?text=Dynamic&gradientType=sliceShape -
speechBubble- Chat bubble with tail/api/svg?text=Hello!&gradientType=speechBubble -
sharkTeeth- Zigzag bottom edge/api/svg?text=Energy&gradientType=sharkTeeth -
largeRounded- Bold rounded corners (61px radius)/api/svg?text=Bold&gradientType=largeRounded
Shape Background Templates (10 new templates)#
Pre-configured templates using shape backgrounds:
capsule-tech- Tech-themed cylinder shapesoft-modern- Modern soft rounded designorganic-egg- Natural egg shapedynamic-slice- Angular diagonal slicechat-bubble- Green chat bubbleenergy-teeth- Purple shark teethbold-rounded- Bold blue roundedcyber-capsule- Cyberpunk capsulegolden-egg- Luxurious golden eggmessage-box- Messenger-style bubble
Usage Examples:
# Use pre-made template
/api/svg?text=Hello&template=chat-bubble
# Custom colors with shape
/api/svg?text=Custom&gradientType=cylinder&color0=FF0000&color1=00FF00
# Shape + text effects
/api/svg?text=Styled&template=cyber-capsule&stroke=00FFFF&strokeWidth=2&animation=fadeIn๐ฎ Future Enhancements#
Potential additional features to consider:
- Multi-line Text Support - Text with line breaks
- Text Alignment Options - Left, right, center positioning
- Font Size Control - Adjustable text size
- Additional Shape Variations:
- Asymmetric shapes
- Arrow/pointer designs
- Badge/shield shapes
โ Testing#
Manual Testing Checklist#
- Text animations work with all gradient types
- Blob morphing creates smooth transitions
- Layered waves show depth effect
- Blur motion creates atmospheric effect
- All templates render correctly
- Animations loop seamlessly
- Custom colors work with new gradients
- Height parameter affects layout properly
- Performance is acceptable on mobile
Test URLs#
# Test each animation
/api/svg?text=FadeIn&animation=fadeIn
/api/svg?text=ScaleIn&animation=scaleIn
/api/svg?text=Blink&animation=blink
/api/svg?text=Blinking&animation=blinking
/api/svg?text=Twinkle&animation=twinkling
# Test each gradient type
/api/svg?text=Blob&gradientType=blobMorph
/api/svg?text=Liquid&gradientType=liquidBlob
/api/svg?text=Organic&gradientType=organicBlob
/api/svg?text=Waves&gradientType=layeredWaves
/api/svg?text=Blur&gradientType=blurMotion
/api/svg?text=Dreamy&gradientType=dreamyCircles
/api/svg?text=Abstract&gradientType=abstractBlur
# Test templates
/api/svg?text=Venom&template=liquid-venom
/api/svg?text=Ocean&template=ocean-depths
/api/svg?text=Dream&template=dreamy-sunset๐ Statistics#
Implementation Summary#
- New Gradient Types: 14 total
- Blob morphing: 3 (blobMorph, liquidBlob, organicBlob)
- Layered waves: 1 (layeredWaves)
- Blur motion: 3 (blurMotion, dreamyCircles, abstractBlur)
- Shape backgrounds: 7 (cylinder, softRounded, eggShape, sliceShape, speechBubble, sharkTeeth, largeRounded)
- New Templates: 25 total
- Blob/wave/blur templates: 15
- Shape background templates: 10
- New Animation Types: 5 (fadeIn, scaleIn, blink, blinking, twinkling)
- New Text Effects: 3 (stroke, textBg, rotate)
- New Files Created: 4
- textAnimationUtils.js
- blobMorphingGradients.js
- blurMotionGradients.js
- shapeBackgroundGradients.js
- Files Modified: 7
- gradientGenerator.js
- pages/api/svg.js
- gradientFactory.js
- gradientConfig.js
- shapeGradients.js
- capsuleShapeTemplates.js
- CAPSULE_RENDER_INTEGRATION.md
- Lines of Code Added: ~1500
- API Parameters Added: 5 (
animation,stroke,strokeWidth,textBg,rotate)
Feature Breakdown#
| Feature | Inspiration | Complexity | Value |
|---|---|---|---|
| Text Animations | capsule-render | Low | High |
| Blob Morphing | Venom effect | Medium | High |
| Layered Waves | Waving effect | Medium | High |
| Blur Motion | Blur effect | Low | Medium |
Generated: 2025-01-10 Integration Version: 1.0.0 Based on capsule-render analysis