Skip to content

MinskLeo/TrueAnimation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TrueAnimation

This is low weight lib, that helps with step-by-step animation

Usage

To use that lib correctly:

  1. Connect lib to your project
<head>

    // Other tags here
    <script src="libs/TrueAnimation.js"></script>
</head>
  1. Make new .js file with your code
  2. Then you need to setup your animation

Select necessary element

let square = document.querySelector(".square");

Init constructor

let anim = new TrueAnimation(square,["width", "height", "opacity"],[{
    duration: 500,
    timingFunction: "linear",
    lastValue: "3px"
  },{
    duration: 500,
    timingFunction: "linear",
    lastValue: "3px"
  },{
    duration: 200,
    timingFunction: "linear",
    lastValue: "0"
  }]);

Almost before an animation you should init css transition rules with init() method

Don't worry about your current transition rules! Lib will automatically save it and restore when the animation ends!

anim.init();

At last, when you want to start animation, use start() method

square.addEventListener("click",()=>{
  anim.start();
});

That's all! Congratulations!

About

Low weight lib, that helps with step-by-step animation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published