Top Related Projects
tsParticles - Easily create highly customizable JavaScript particles effects, confetti explosions and fireworks animations and use them as animated backgrounds for your website. Ready to use components available for React.js, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, Inferno, Solid, Riot and Web Components.
A lightweight JavaScript library for creating particles
JavaScript animation engine
GSAP (GreenSock Animation Platform), a JavaScript animation library for the modern web
The motion graphics toolbelt for the web
Quick Overview
Whirl is a collection of CSS loading animations and spinners. It provides a variety of customizable, pure CSS loading indicators that can be easily integrated into web projects. The repository offers a simple way to add visually appealing loading animations without the need for JavaScript or external libraries.
Pros
- Pure CSS implementations, reducing dependency on JavaScript
- Wide variety of animation styles to choose from
- Easily customizable through CSS variables
- Lightweight and performant
Cons
- Limited browser support for some advanced CSS features used
- May require additional work to make fully accessible
- Some animations might be too complex for certain use cases
Code Examples
Here are a few examples of how to use Whirl in your project:
Basic spinner:
<div class="whirl"></div>
Customized spinner with different color and size:
<div class="whirl" style="--whirl-color: #ff0000; --whirl-size: 50px;"></div>
Using a specific animation style:
<div class="whirl whirl-ripple"></div>
Getting Started
To use Whirl in your project, follow these steps:
- Download the
whirl.css
file from the repository. - Include the CSS file in your HTML:
<link rel="stylesheet" href="path/to/whirl.css">
- Add the desired spinner to your HTML:
<div class="whirl"></div>
- Customize the spinner using CSS variables if needed:
<div class="whirl" style="--whirl-color: #00ff00;"></div>
Competitor Comparisons
tsParticles - Easily create highly customizable JavaScript particles effects, confetti explosions and fireworks animations and use them as animated backgrounds for your website. Ready to use components available for React.js, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, Inferno, Solid, Riot and Web Components.
Pros of tsparticles
- More feature-rich and customizable particle system
- Supports multiple rendering modes (canvas, WebGL)
- Active development with frequent updates and community support
Cons of tsparticles
- Larger file size and potentially higher performance overhead
- Steeper learning curve due to extensive configuration options
Code Comparison
tsparticles:
tsParticles.load("tsparticles", {
particles: {
number: { value: 80 },
color: { value: "#ff0000" },
shape: { type: "circle" },
move: { enable: true, speed: 6 }
}
});
Whirl:
.whirl:after {
content: "";
z-index: 10;
position: absolute;
top: 50%;
left: 50%;
margin: -25px 0 0 -25px;
width: 50px;
height: 50px;
border-radius: 50%;
border: 4px solid rgba(0, 0, 0, 0.1);
border-top-color: #000;
animation: spin 1s infinite linear;
}
Summary
tsparticles offers a more comprehensive particle system with extensive customization options, while Whirl provides simple CSS-based loading animations. tsparticles is better suited for complex particle effects, whereas Whirl is ideal for lightweight, easy-to-implement loading indicators.
A lightweight JavaScript library for creating particles
Pros of particles.js
- More feature-rich and customizable, offering various particle shapes, sizes, and behaviors
- Supports interactive elements, allowing particles to respond to user actions
- Widely adopted and well-documented, with a large community and numerous examples
Cons of particles.js
- Larger file size and potentially higher performance impact, especially with many particles
- More complex setup and configuration compared to Whirl's simpler approach
- May require more effort to integrate into existing projects due to its comprehensive nature
Code Comparison
particles.js:
particlesJS("particles-js", {
particles: {
number: { value: 80, density: { enable: true, value_area: 800 } },
color: { value: "#ffffff" },
shape: { type: "circle" },
// ... more configuration options
}
});
Whirl:
.whirl {
width: 100px;
height: 100px;
border: 5px solid #fff;
border-top-color: #000;
border-radius: 50%;
animation: spin 1s infinite linear;
}
The code comparison highlights the difference in approach between the two libraries. particles.js uses JavaScript for configuration and offers more customization options, while Whirl relies on simple CSS classes for creating loading animations. particles.js is better suited for complex particle systems, whereas Whirl excels in creating straightforward, lightweight loading indicators.
JavaScript animation engine
Pros of Anime
- More comprehensive animation library with a wider range of features
- Better performance for complex animations due to optimized JavaScript engine
- Extensive documentation and examples for easier implementation
Cons of Anime
- Larger file size, which may impact load times for smaller projects
- Steeper learning curve for beginners due to more complex API
- May be overkill for simple animation needs
Code Comparison
Whirl (CSS-based animation):
.whirl {
animation: spin 1s linear infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
Anime (JavaScript-based animation):
anime({
targets: '.element',
rotate: '1turn',
duration: 1000,
easing: 'linear',
loop: true
});
Summary
Whirl is a lightweight CSS-based animation library, ideal for simple animations and projects with minimal JavaScript requirements. It's easy to use but limited in functionality.
Anime is a more powerful JavaScript animation library, offering advanced features and better performance for complex animations. However, it comes with a larger file size and may be more complex to implement for basic needs.
Choose Whirl for quick, simple animations with minimal overhead, or Anime for more sophisticated animation requirements and projects that can benefit from its extensive features.
GSAP (GreenSock Animation Platform), a JavaScript animation library for the modern web
Pros of GSAP
- More comprehensive animation toolkit with a wider range of features
- Better performance for complex animations and large-scale projects
- Extensive documentation and community support
Cons of GSAP
- Larger file size and potential overhead for simple projects
- Steeper learning curve for beginners
- Commercial license required for some use cases
Code Comparison
GSAP:
gsap.to(".box", {duration: 2, x: 300, rotation: 360, ease: "bounce"});
Whirl:
.box {
animation: whirl 2s ease-in-out infinite;
}
Summary
GSAP is a powerful animation library with extensive features and performance optimizations, making it suitable for complex projects. However, it comes with a larger file size and potential licensing costs. Whirl, on the other hand, is a lightweight CSS animation library that's easier to implement for simple animations but may lack the advanced capabilities of GSAP. The choice between the two depends on project requirements, complexity, and performance needs.
The motion graphics toolbelt for the web
Pros of mojs
- More comprehensive animation toolkit with a wider range of features
- Better documentation and community support
- Supports complex motion graphics and interactive animations
Cons of mojs
- Steeper learning curve due to its extensive API
- Larger file size, which may impact page load times
- Requires more setup and configuration for basic animations
Code Comparison
mojs:
const burst = new mojs.Burst({
radius: { 0: 100 },
count: 5,
children: {
shape: 'circle',
fill: { 'cyan' : 'yellow' },
duration: 2000
}
});
Whirl:
.whirl {
width: 100px;
height: 100px;
border: 5px solid #3498db;
border-top: 5px solid #e74c3c;
border-radius: 50%;
animation: spin 1s linear infinite;
}
Summary
mojs is a powerful JavaScript animation library offering complex motion graphics capabilities, while Whirl is a simpler CSS-based loading animation solution. mojs provides more flexibility and features but requires JavaScript knowledge and setup. Whirl offers quick, lightweight CSS animations but with limited customization options. Choose mojs for advanced, interactive animations, and Whirl for simple, efficient loading spinners.
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
Whirl
CSS loading animations with minimal effort!
whirl
is a curation of CSS loading animations(whirls! ð
). It started as a drop in CSS
file to get easy animations using :pseudo
elements. It's now a collection of loading animations to use, take inspiration from, change and do what you want with ð
No CSS distro?
It's inefficient. It's likely an app will only use one or two loaders. Pulling them all into an app would be overkill. Most projects use some form of bundling making it possible to import a single loader's styles.
Usage
You've got different options here.
You can install whirl
and import the styles you want. You get both CSS and SASS files ð
npm i @jh3y/whirl
yarn add @jh3y/whirl
Alternatively, you can grab the CSS or SASS and change to your needs. There's a dynamic link in the demo. Or visit the latest versions tag branch ð
â ï¸ Be aware that if you're bundling, you'll likely have to override some styles. Be careful with conflicting classnames or animation names.
Contributing
See CONTRIBUTING
.
@jh3y ð» 2019
Top Related Projects
tsParticles - Easily create highly customizable JavaScript particles effects, confetti explosions and fireworks animations and use them as animated backgrounds for your website. Ready to use components available for React.js, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, Inferno, Solid, Riot and Web Components.
A lightweight JavaScript library for creating particles
JavaScript animation engine
GSAP (GreenSock Animation Platform), a JavaScript animation library for the modern web
The motion graphics toolbelt for the web
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