4

5 Useful and Interesting Web Animation Libraries

 2 years ago
source link: https://dev.to/surajondev/5-useful-and-interesting-web-animation-libraries-4d6m
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

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

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.

Installation

$ npm install animate.css --save
Enter fullscreen modeExit fullscreen mode

SCRIPT:

<head>
  <link
    rel="stylesheet"
    href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"
  />
</head>
Enter fullscreen modeExit fullscreen mode

Usage

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

<h1 class="animate__animated animate__bounce">An animated element</h1>
Enter fullscreen modeExit fullscreen mode

CodePen Example

Rerun to see the animation again


Anime.js

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.

Installation

$ npm install animejs --save
Enter fullscreen modeExit fullscreen mode

SCRIPT:

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

Download script here or visit their GitHub page to download it.

  <script src="anime.min.js"></script>
Enter fullscreen modeExit fullscreen mode

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.

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

CodePen Example


Hover.css

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

Installation

$ npm install hover.css --save
Enter fullscreen modeExit fullscreen mode

FILE:
You can download the CSS file and link it in the HTML between head tag. Download it [here] or visit GitHub page of hover.css.

<head>
    <link href="css/hover-min.css" rel="stylesheet">
</head>
Enter fullscreen modeExit fullscreen mode

Usage

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

<button class="hvr-underline-from-center">
  Click Me!
</button>
Enter fullscreen modeExit fullscreen mode

CodePen Example

Velocity

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

Installation

$ npm install --save velocity-react
Enter fullscreen modeExit fullscreen mode

SCRIPT:

<script src="//cdn.jsdelivr.net/npm/[email protected]/velocity.ui.min.js"></script>
Enter fullscreen modeExit fullscreen mode

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.

element.velocity(
  {
    marginTop:200,
  },
  {
    duration:1500,
    loop:true,
    easing:'swing'
  }
)
Enter fullscreen modeExit fullscreen mode

CodePen Example


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.

Installation

$ npm install three-dots --save
Enter fullscreen modeExit fullscreen mode

FILE:
Include the CSS in your file

<link href="/path/to/three-dots.css" rel="stylesheet">
Enter fullscreen modeExit fullscreen mode

Usage

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

<div class="dot-pulse"/>
Enter fullscreen modeExit fullscreen mode

CodePen Example


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.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK