animxyz
The first truly composable CSS animation library. Built for Vue, React, SCSS, and CSS, AnimXYZ will bring your website to life.
Top Related Projects
🍿 A cross-browser library of CSS animations. As easy to use as an easy thing.
JavaScript animation engine
CSS3 Animations with special effects
A collection of CSS3 powered hover effects to be applied to links, buttons, logos, SVG, featured images and so on. Easily apply to your own elements, modify or just use for inspiration. Available in CSS, Sass, and LESS.
Tasty CSS-animated Hamburgers
Quick Overview
AnimXYZ is a composable CSS animation toolkit that provides a powerful and flexible way to add animations to web projects. It allows developers to create complex animations using simple utility classes and custom properties, making it easy to implement and customize animations without writing extensive CSS keyframes.
Pros
- Highly customizable with a wide range of pre-built animations and utilities
- Lightweight and performant, with minimal impact on page load times
- Easy to integrate with existing projects and frameworks
- Supports both CSS and JavaScript implementations for added flexibility
Cons
- Learning curve for understanding the utility-based approach
- May require additional setup for optimal use with certain build tools
- Limited browser support for older versions (IE11 and below not supported)
- Documentation could be more comprehensive for advanced use cases
Code Examples
- Basic fade and move animation:
<div class="xyz-in" xyz="fade up big">
<h1>Hello AnimXYZ!</h1>
</div>
- Staggered animation for list items:
<ul class="xyz-in" xyz="fade small stagger">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
- Custom animation using variables:
<div class="xyz-in" xyz="fade rotate-right duration-10 ease-out-back">
<p>Custom animated element</p>
</div>
- JavaScript implementation for dynamic animations:
import 'animxyz'
const element = document.querySelector('.my-element')
element.setAttribute('xyz', 'fade down big')
element.classList.add('xyz-in')
Getting Started
- Install AnimXYZ:
npm install @animxyz/core
- Import the CSS in your main stylesheet:
@import '@animxyz/core';
- Add AnimXYZ classes and attributes to your HTML:
<div class="xyz-in" xyz="fade up big">
<h1>Animated Content</h1>
</div>
- For Vue.js projects, install the Vue directive:
npm install @animxyz/vue
Then add it to your Vue app:
import { VueAnimXyz } from '@animxyz/vue'
import '@animxyz/core'
Vue.use(VueAnimXyz)
Now you can use AnimXYZ in your Vue components!
Competitor Comparisons
🍿 A cross-browser library of CSS animations. As easy to use as an easy thing.
Pros of Animate.css
- Larger community and longer history, resulting in more resources and examples
- Simpler implementation with predefined classes for quick use
- Wider browser compatibility, including older versions
Cons of Animate.css
- Less flexibility and customization options
- Larger file size when using the entire library
- Limited control over animation composition and sequencing
Code Comparison
AnimXYZ:
.xyz-in {
--xyz-translate-x: 25%;
--xyz-opacity: 0;
--xyz-duration: 0.5s;
}
Animate.css:
.animate__animated.animate__fadeInRight {
animation: fadeInRight 1s;
}
Key Differences
AnimXYZ offers a more modular approach with fine-grained control over animation properties, while Animate.css provides ready-to-use, predefined animations. AnimXYZ uses CSS variables for customization, whereas Animate.css relies on predefined keyframe animations. AnimXYZ allows for easier composition of complex animations, while Animate.css is simpler to implement for basic use cases.
Both libraries have their strengths, and the choice between them depends on the project's specific needs, desired level of customization, and target browser support.
JavaScript animation engine
Pros of anime
- More mature and widely adopted project with a larger community
- Supports a broader range of animation types and properties
- Offers more advanced features like timeline and playback controls
Cons of anime
- Larger file size and potentially higher performance overhead
- Steeper learning curve for complex animations
- Less focused on CSS-based animations compared to animxyz
Code Comparison
animxyz:
<div class="xyz-in" xyz="fade up big">
Animate me!
</div>
anime:
anime({
targets: '.element',
translateY: [-100, 0],
opacity: [0, 1],
duration: 1000,
easing: 'easeOutElastic(1, .8)'
});
Summary
animxyz is a CSS-based animation library that focuses on simplicity and ease of use, particularly for Vue.js projects. It offers a declarative approach to animations using utility classes and custom attributes.
anime is a more comprehensive JavaScript animation library that provides greater flexibility and control over animations. It supports a wide range of animation types and offers advanced features like timelines and playback controls.
While animxyz excels in quick, CSS-driven animations, anime is better suited for complex, programmatic animations that require fine-tuned control. The choice between the two depends on the specific project requirements and the developer's preferred animation approach.
CSS3 Animations with special effects
Pros of magic
- Simpler syntax and easier to implement for basic animations
- Smaller file size, making it more lightweight for projects
- Wider browser compatibility, including older versions
Cons of magic
- Limited customization options compared to AnimXYZ
- Fewer animation types and effects available
- Less flexibility for complex, multi-step animations
Code Comparison
magic:
.magictime {
animation-duration: 1s;
animation-fill-mode: both;
}
.puffIn {
animation-name: puffIn;
}
AnimXYZ:
<div class="xyz-in" xyz="fade up big">
Animate me!
</div>
@import '@animxyz/core';
.xyz-in {
@include xyz-in;
}
AnimXYZ offers more granular control over animations through its utility classes and custom attributes, while magic provides pre-defined animations that are easier to implement but less customizable. AnimXYZ's approach allows for more complex and tailored animations, but may require more setup and understanding of its system.
A collection of CSS3 powered hover effects to be applied to links, buttons, logos, SVG, featured images and so on. Easily apply to your own elements, modify or just use for inspiration. Available in CSS, Sass, and LESS.
Pros of Hover
- Simpler to implement with pre-defined CSS classes
- Focuses specifically on hover effects, making it easier to use for this purpose
- Larger collection of ready-to-use hover effects
Cons of Hover
- Limited to hover interactions only
- Less flexible for creating custom animations
- Requires adding multiple classes to achieve desired effects
Code Comparison
Hover:
<div class="hover-effect">
<a href="#" class="hvr-grow">Grow</a>
<a href="#" class="hvr-shrink">Shrink</a>
<a href="#" class="hvr-pulse">Pulse</a>
</div>
AnimXYZ:
<div class="xyz-in" xyz="fade up big">
<div class="item">Fade up big</div>
<div class="item">Fade up big</div>
<div class="item">Fade up big</div>
</div>
AnimXYZ offers more flexibility in creating custom animations with its utility-first approach, while Hover provides a set of predefined hover effects that are easy to implement. AnimXYZ allows for more complex animations beyond just hover effects, but may require more setup and understanding of its syntax. Hover is more straightforward for adding simple hover interactions but is limited in its scope and customization options.
Tasty CSS-animated Hamburgers
Pros of hamburgers
- Focused specifically on hamburger menu animations
- Includes a variety of pre-built hamburger styles
- Lightweight and easy to implement for a single use case
Cons of hamburgers
- Limited to hamburger menu animations only
- Less flexible for creating custom animations
- Requires additional CSS for responsive design
Code Comparison
hamburgers:
.hamburger {
padding: 15px 15px;
display: inline-block;
cursor: pointer;
transition-property: opacity, filter;
transition-duration: 0.15s;
transition-timing-function: linear;
font: inherit;
color: inherit;
text-transform: none;
background-color: transparent;
border: 0;
margin: 0;
overflow: visible;
}
AnimXYZ:
<div class="xyz-in" xyz="fade up big">
<h1>Hello AnimXYZ!</h1>
</div>
AnimXYZ offers a more versatile animation system that can be applied to various elements, while hamburgers focuses solely on hamburger menu animations. AnimXYZ uses a declarative approach with utility classes and attributes, making it easier to create complex animations without writing custom CSS. However, hamburgers provides a simpler solution for developers who only need hamburger menu animations and prefer a more traditional CSS approach.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
AnimXYZ
AnimXYZ helps you create, customize, and compose animations for your website. Powered by CSS variables to allow a nearly limitless number of unique animations without writing a single keyframe. Save time and have complete control over how your elements move. Built for Vue, React, SCSS, and CSS, AnimXYZ will bring your website to life.
For example here is how you make an element fade and shrink in from above:
<div class="xyz-in" xyz="fade up big">I will animate in!</div>
Changing the class to xyz-out
reverses the direction of the animation:
<div class="xyz-out" xyz="fade up big">I will animate out!</div>
For simple animations, that's all you need, but AnimXYZ can do so much more! Check out the AnimXYZ docs!
Installation
Using a package manager
AnimXYZ can be installed using your favorite package manager:
# with npm
npm install @animxyz/core
# with yarn
yarn add @animxyz/core
After installation, you will need to import AnimXYZ into your project.
Import into a Webpack project
If your Webpack project uses css-loader
you can import the CSS by putting this snippet anywhere in your javascript code:
import '@animxyz/core'
Import into a SASS project
AnimXYZ is built in SASS and provides useful functions and mixins for customization. Import it anywhere in your SASS code:
// Import the functions/mixins
@import '@animxyz/core';
// Add all the core/utilities selectors
@include xyz-all;
// --- Or for more control and granularity ---
@include xyz-core;
@include xyz-utilities;
Using jsDelivr
To add AnimXYZ using a CDN put this link in the <head>
of your index.html
file:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@animxyz/core">
Vue & React
If you are using AnimXYZ in a Vue or React project we strongly recommend you also use our AnimXYZ components. To add those, follow the installation instructions in the relevant sections Vue and React.
Made By
Top Related Projects
🍿 A cross-browser library of CSS animations. As easy to use as an easy thing.
JavaScript animation engine
CSS3 Animations with special effects
A collection of CSS3 powered hover effects to be applied to links, buttons, logos, SVG, featured images and so on. Easily apply to your own elements, modify or just use for inspiration. Available in CSS, Sass, and LESS.
Tasty CSS-animated Hamburgers
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot