Create smooth animations without JavaScript frameworks
Learn how to use hyperscript's transition command with CSS to create beautiful
fade-in, fade-out, and slide effects. Perfect for polished user experiences!
transitionsopacitytogglewait
Demo 1: Fade In/Out
Toggle opacity for smooth fade effects:
💫 Fading Content
Watch this box fade in and out smoothly using CSS transitions
and hyperscript's opacity toggle!
Demo 2: Slide Transition
Combine transform and opacity for slide effects:
🎯 Sliding Panel
This panel slides in and out using CSS transforms.
The .slide-out class applies translateX(-100%) with opacity transition.
Demo 3: Toast Notification
Auto-dismissing notification with fade animation:
✅ Success! This notification will auto-dismiss in 3 seconds.
Demo 4: Sequential Fade
Chain multiple fade animations in sequence:
Box 1
Box 2
Box 3
Demo 5: Scale & Rotate
Combine multiple transform effects:
Transform Demo
This box can scale and rotate with smooth CSS transitions!
<!-- Fade in on page load -->
<div _="on load
add .fade-out to me
wait 0.1s
remove .fade-out from me">
Content
</div>
<!-- Stagger animation for list items -->
<button _="on click
repeat for item in .list-item index i
add .fade-in to item
wait 0.2s
end">
Animate List
</button>
<!-- Bounce effect -->
<button _="on click
add .scale-up to #element
wait 0.3s
remove .scale-up from #element">
Bounce
</button>
<!-- Crossfade between elements -->
<button _="on click
add .fade-out to #panel-1
wait 0.5s
hide #panel-1
show #panel-2
remove .fade-out from #panel-2">
Crossfade
</button>
Common Use Cases:
Toast Notifications: Auto-dismissing messages
Modal Overlays: Fade in/out backdrop and dialog
Image Galleries: Crossfade between images
Loading States: Fade out spinner, fade in content
Menu Animations: Slide in/out navigation panels
List Animations: Stagger fade-in for items
Performance Tips:
Use opacity and transform - they're GPU-accelerated
Avoid animating width, height, top, left
Use will-change CSS property for complex animations
Keep animations under 300-500ms for snappy feel
Use ease-out for entrances, ease-in for exits
Try it yourself:
Create a loading skeleton that fades in content when ready
Build a carousel with crossfade transitions
Make a notification queue with staggered animations
Add hover effects that scale and change opacity
Create an accordion with smooth height transitions