Reveal Effect
Scroll-triggered entrance animations using IntersectionObserver. Elements animate into view as they enter the viewport.

See Also

All JavaScript Effects Breathe Pulse Scribe Scramble Counter Ripple Shake Twinkle

Domma.effects.reveal()

The reveal() effect uses IntersectionObserver to trigger CSS transitions when elements scroll into view. Supports fade, slide, zoom, and flip animations with stagger support for groups of elements.

// Simple fade-in on scroll
Domma.effects.reveal('.card');

// Slide up with stagger
const ctrl = Domma.effects.reveal('.feature', {
  animation: 'slide-up',
  duration: 800,
  stagger: 100,
  threshold: 0.2,
  onReveal: (el) => console.log('Revealed:', el)
});

// Clean up
ctrl.destroy();
  Scroll down to see the reveal animations

Demo: Fade (Default)

Elements fade in smoothly as they enter the viewport.

Fast

Lightning performance

Secure

Built-in protection

Clean

Readable API

Domma.effects.reveal('.reveal-fade-demo', {
  animation: 'fade',
  duration: 600,
  stagger: 150
});

Demo: Slide Up

Elements slide upward from below as they enter.

Feature One

Slide-up entrance

Feature Two

Staggered timing

Feature Three

Smooth easing

Feature Four

GPU-accelerated

Domma.effects.reveal('.reveal-slideup-demo', {
  animation: 'slide-up',
  duration: 800,
  stagger: 120,
  easing: 'ease-out'
});

Demo: Slide Left & Right

Elements slide in from the sides.

From the Right

Slides left into view

From the Left

Slides right into view

// Slide in from right
Domma.effects.reveal('.slide-left', { animation: 'slide-left' });

// Slide in from left
Domma.effects.reveal('.slide-right', { animation: 'slide-right' });

Demo: Zoom

Elements scale up from a smaller size.

🚀

Launch

⚡

Speed

đŸŽ¯

Precision

Domma.effects.reveal('.reveal-zoom-demo', {
  animation: 'zoom',
  duration: 700,
  stagger: 200
});

Demo: Flip

Elements flip in with a 3D perspective transform.

3D Flip Entrance

Uses perspective transform for depth

Domma.effects.reveal('.flip-card', {
  animation: 'flip',
  duration: 900
});

Demo: Re-animate on Re-entry

With once: false, elements re-animate every time they enter the viewport. Scroll up and down to see them repeat.

Repeatable

Animates on every scroll

Repeatable

Scroll up and back down

Domma.effects.reveal('.repeatable', {
  animation: 'slide-up',
  once: false  // Re-animate on re-entry
});

Options Reference

Option Type Default Description
animationstring'fade'Animation type: 'fade', 'slide-up', 'slide-down', 'slide-left', 'slide-right', 'zoom', 'flip'
durationnumber600Animation duration in ms
easingstring'ease-out'CSS easing function
delaynumber0Delay before animation in ms
staggernumber0Delay between multiple elements in ms
thresholdnumber0.1IntersectionObserver threshold (0-1)
rootMarginstring'0px'Observer root margin
oncebooleantrueOnly animate once, or re-animate on re-entry
respectMotionPreferencebooleantrueHonour prefers-reduced-motion
onRevealfunctionnullCallback per element when revealed