Dedicated showcase pages for each effect, plus a real-world example:
Breathe Pulse Scribe Reveal Scramble Counter Ripple Shake Twinkle Celebrations DemoThe effects module provides reusable animation utilities for adding visual polish to your UI elements. All effects support accessibility features like prefers-reduced-motion and provide control objects for pause/resume/destroy.
prefers-reduced-motionBoth breathe() and pulse() support these options:
| Option | Type | Default | Description |
|---|---|---|---|
amplitude / scale |
number | 6 / 1.05 | Movement distance (breathe) or scale factor (pulse) |
duration |
number | 3000 / 2000 | Complete animation cycle time in milliseconds |
easing |
string | 'ease-in-out' | CSS easing function |
delay |
number | 0 | Initial delay before animation starts (ms) |
stagger |
number | 0 | Delay between multiple elements (ms) |
iterations |
number | 'infinite' | 'infinite' | Number of animation cycles |
pauseOnHover |
boolean | false | Pause animation when hovering over element |
autoStart |
boolean | true | Start animation immediately |
respectMotionPreference |
boolean | true | Honor prefers-reduced-motion setting |
onStart |
function | null | Callback when animation starts |
onComplete |
function | null | Callback when animation completes (finite iterations only) |
| Method | Description |
|---|---|
pause() |
Pause the animation |
resume() |
Resume a paused animation |
stop() |
Stop the animation completely |
restart() |
Restart the animation from the beginning |
destroy() |
Stop animation and clean up all resources |
isRunning() |
Check if animation is currently running |
isPaused() |
Check if animation is paused |
Domma.effects respects user motion preferences by default.
If a user has enabled "Reduce motion" in their system settings, effects will be automatically disabled. You can override this with respectMotionPreference: false.
// Respects system preference (default)
Domma.effects.breathe('.element', {
respectMotionPreference: true
});
// Forces animation even if user prefers reduced motion
Domma.effects.breathe('.element', {
respectMotionPreference: false
});
// Stat card with subtle breathe
Domma.effects.breathe('.stat-card', {
amplitude: 6,
duration: 3000,
stagger: 200,
pauseOnHover: true
});
// Notification badge with pulse
Domma.effects.pulse('.badge-notification', {
scale: 1.15,
duration: 1500
});
// Feature cards with staggered entrance
Domma.effects.breathe('.feature-card', {
amplitude: 8,
stagger: 150,
iterations: 3,
onComplete: () => {
console.log('All cards animated!');
}
});
// Hero typewriter with looping messages
Domma.effects.scribe('.hero-headline', {
speed: 60,
loop: true,
loopDelay: 2000,
actions: [
{ render: 'Build Amazing Apps', effect: 'bounce' },
{ wait: '2.5s' },
{ undoRender: 'all' },
{ render: 'Ship Faster', effect: 'fade' },
{ wait: '2.5s' },
{ undoRender: 'all' }
]
});
// Terminal-style command output
Domma.effects.scribe('.terminal-output', {
speed: 20,
cursor: true,
cursorChar: '_',
actions: [
{ render: '$ npm install domma', effect: 'none' },
{ wait: '1s' },
{ render: '\n✓ Installed successfully', effect: 'fade' }
]
});