5 Useful and Interesting Web Animation Libraries
Tags: css, javascript, beginners, webdev
Published: 2021-11-27 17:23:05

# Introduction

Libraries help us to code faster through their predefined classes for different functions. Your idea of the project and combining it with the libraries to add functionality, make a great project.

Today, we are going to look into CSS animation libraries to help you add beautiful customizable animation to your web page.

So let's get started.

## [Animate.css](https://animate.style/)

> Animate.css is a library of ready-to-use, cross-browser animations for use in your web projects. Great for emphasis, home pages, sliders, and attention-guiding hints.

![Animate.css](https://scotch-res.cloudinary.com/image/upload/w_1050,q_auto:good,f_auto/media/8630/XHRQu3mBQGmVGlD4C6tL_animatecss.gif)

### Installation

NPM:
```bat
$ npm install animate.css --save
```

SCRIPT:

```html
<head>
  <link
    rel="stylesheet"
    href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"
  />
</head>
```
### Usage

You can add the pre-define animation classes to any element to which you want to add the animation.

```html
<h1 class="animate__animated animate__bounce">An animated element</h1>
```

## CodePen Example

*Rerun to see the animation again*
{% codepen https://codepen.io/surajsrv11/pen/GRvXVXq %}

---

# [Anime.js](https://animejs.com/)

> Anime.js is a lightweight JavaScript animation library with a simple, yet powerful API.
It works with CSS properties, SVG, DOM attributes and JavaScript Objects.

![Anime.js](https://uploads.sitepoint.com/wp-content/uploads/2016/10/1477673935anime-logo.png)

### Installation

NPM:
```bat
$ npm install animejs --save
```

SCRIPT:

You can download the script add it to the project download. Link the script as a normal script.

Download script [**here**](https://github.com/juliangarnier/anime/archive/master.zip) or visit their [GitHub](https://github.com/juliangarnier/anime/) page to download it.

```html
  <script src="anime.min.js"></script>
```

### Usage

Anime.js is one of my favorites to add animation to my projects. You just need to use the `anime` function and add all the animation parameters to it. You can find more about arguments and values in the documentation [**here**](https://animejs.com/documentation/).

```javascript
anime({
    targets:'.box',
    translateY: 250,
    scale: 2,
    duration: 2000,
    background: '#4C0070',
    borderRadius:50,
    rotate: '1turn',
    easing: 'easeInOutExpo',
    loop:true
})
```

### CodePen Example

{% codepen https://codepen.io/surajsrv11/pen/GRvYKKr %}

---

# [Hover.css](http://ianlunn.github.io/Hover/)

> 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.

![Hover.css](https://assets.codepen.io/239346/internal/screenshots/pens/waBgya.default.png?fit=cover&format=auto&ha=true&height=540&quality=75&v=2&version=1430082140&width=960)

### Installation

NPM:
```bat
$ npm install hover.css --save
```

FILE:
You can download the CSS file and link it in the HTML between head tag. Download it [**here**] or visit [**GitHub**](https://github.com/IanLunn/Hover) page of hover.css.

```html
<head>
	<link href="css/hover-min.css" rel="stylesheet">
</head>
```

### Usage
It is a set of predefined classes that you can use as a class name for your element.

```html
<button class="hvr-underline-from-center">
  Click Me!
</button>
``` 

### CodePen Example

{% codepen https://codepen.io/surajsrv11/pen/XWerrJw %}

# [Velocity](http://velocityjs.org/)

> Accelerated JavaScript animation. It's incredibly fast, and it features color animation, transforms, loops, easings, SVG support, and scrolling.

![Velocity](https://assets.awwwards.com/awards/external/2016/12/58414eaf71dcd.jpg)

### Installation

NPM:

```bat
$ npm install --save velocity-react
```

SCRIPT:

```html
<script src="//cdn.jsdelivr.net/npm/velocity-animate@2.0/velocity.ui.min.js"></script>
```

### Usage

Velocity functions take two objects, the first one is properties and the second one is options. You can define all the properties you want to animate in the properties object. Option object contains different options related to animation such duration, loop, easing, etc.  

```javascript
element.velocity(
  {
    marginTop:200,
  },
  {
    duration:1500,
    loop:true,
    easing:'swing'
  }
)
```

### CodePen Example

{% codepen https://codepen.io/surajsrv11/pen/YzrKKQZ %}

---

# [Three Dots](https://nzbin.github.io/three-dots/)

> The project is a set of CSS loading animations created with three dots which made by just single element. I think the project can not only enhance your CSS skills but also improve your imagination.

![Three Dots](https://www.bypeople.com/wp-content/uploads/2018/06/three-dots-css-loading-animations.png)

### Installation

NPM:
```bat
$ npm install three-dots --save
```

FILE:
Include the CSS in your file

```html
<link href="/path/to/three-dots.css" rel="stylesheet">
```

### Usage

You just need to add the class name to the element.

```html
<div class="dot-pulse"/>
```

### CodePen Example

{% codepen https://codepen.io/surajsrv11/pen/PoJYNWJ %}

---

# Last Note

These are useful and interesting animation libraries to bring life to the web element. I hope you will use one of the above libraries in your next project.

Thanks for reading the blog post.