@danilidonbeltran/simple-css-animations
v1.0.3
Published
Some simple CSS animations
Readme
Simple CSS Animations
A lightweight collection of simple, performant CSS animations for modern web applications. This library provides a comprehensive set of keyframe animations using modern CSS properties like translate, scale, and rotate for optimal performance.
Built with SCSS and compiled to a single, optimized CSS file for easy integration.
Installation
npm install @danilidonbeltran/simple-css-animationsUsage
Import the compiled CSS library
@import url("@danilidonbeltran/simple-css-animations");Or in your HTML:
<link rel="stylesheet" href="node_modules/@danilidonbeltran/simple-css-animations/dist/index.css">Using with build tools
If you're using a bundler like Webpack, Vite, or similar:
import '@danilidonbeltran/simple-css-animations';Apply animations to elements
.animated-element {
animation: bounce-in 1s ease-out;
}
.fade-element {
animation: fade-in 0.5s ease-in-out;
}Development
This project uses SCSS for development and compiles to a single CSS file for distribution.
Build Process
# Install dependencies
npm install
# Build the CSS from SCSS sources
npm run build
# Watch for changes during development
npm run devProject Structure
src/
├── index.scss # Main entry point
├── show-animations.scss # Entrance animations
└── hide-animations.scss # Exit animations
dist/
└── index.css # Compiled CSS (ready for production)Available Animations
Show/Entrance Animations
Bounce Animations
bounce- Simple bouncing effectbounce-in- Bouncing entrance with scalebounce-in-left- Bounce in from the leftbounce-in-right- Bounce in from the rightbounce-in-up- Bounce in from abovebounce-in-down- Bounce in from below
Fade Animations
fade-in- Simple fade infade-in-up- Fade in while moving upfade-in-down- Fade in while moving downfade-in-left- Fade in while moving from leftfade-in-right- Fade in while moving from right
Slide Animations
slide-in- Generic slide inslide-in-right- Slide in from the rightslide-in-left- Slide in from the leftslide-in-top- Slide in from the topslide-in-bottom- Slide in from the bottom
Zoom Animations
zoom-in- Simple zoom inzoom-in-down- Zoom in from abovezoom-in-up- Zoom in from belowzoom-in-left- Zoom in from the leftzoom-in-right- Zoom in from the right
Roll Animations
roll-in-right- Roll in from the rightroll-in-left- Roll in from the left
Rotation Animations
rotate- Simple rotationrotate-in- Rotating entrance
Special Effects
flash- Flashing effectflip- Simple flipflip-in- Flipping entranceheartbeat- Heartbeat pulse effectjack-in-the-box- Spring-like entrancelight-speed-in- High-speed entrancepulse- Pulsing effectshake- Shaking effectswing- Swinging motiontada- Celebration effectwobble- Wobbling motion
Hide/Exit Animations
Bounce Out Animations
bounce-out- Bouncing exit with scalebounce-out-left- Bounce out to the leftbounce-out-right- Bounce out to the rightbounce-out-up- Bounce out upwardbounce-out-down- Bounce out downward
Fade Out Animations
fade-out- Simple fade outfade-out-up- Fade out while moving upfade-out-down- Fade out while moving downfade-out-left- Fade out while moving leftfade-out-right- Fade out while moving right
Slide Out Animations
slide-out- Generic slide outslide-out-right- Slide out to the rightslide-out-left- Slide out to the leftslide-out-top- Slide out to the topslide-out-bottom- Slide out to the bottom
Zoom Out Animations
zoom-out- Simple zoom outzoom-out-down- Zoom out downwardzoom-out-up- Zoom out upwardzoom-out-left- Zoom out to the leftzoom-out-right- Zoom out to the right
Roll Out Animations
roll-out-right- Roll out to the rightroll-out-left- Roll out to the left
Other Exit Effects
flip-out- Flipping exitlight-speed-out- High-speed exitrotate-out- Rotating exit
Examples
Basic Usage
<div class="box" style="animation: bounce-in 1s ease-out;">
Hello World!
</div>Chaining Animations
.element {
animation: fade-in 0.5s ease-in-out;
}
.element.exit {
animation: fade-out 0.3s ease-in-out;
}Custom Timing
.slow-bounce {
animation: bounce-in 2s ease-out;
}
.fast-fade {
animation: fade-in 0.2s ease-in-out;
}Animation with Delays
.delayed-animation {
animation: slide-in-right 0.6s ease-out 0.3s both;
}Browser Support
These animations use modern CSS properties and are optimized for performance:
- Uses
translate,scale, androtatefor hardware acceleration - Compatible with all modern browsers
- Optimized for 60fps animations
Performance Notes
- All animations use transform properties (
translate,scale,rotate) which are GPU-accelerated - Avoid animating layout-affecting properties for best performance
- Consider using
animation-fill-mode: bothto maintain start/end states
License
ISC License - see package.json for details.
Author
Daniel J.L. Beltran
