Introduction to Anime.js Last Updated : 25 Jul, 2024 Comments Improve Suggest changes Like Article Like Report Anime.js is a small, lightweight JavaScript library with a simple and small powerful API. It works with the DOM element, CSS, and JavaScript object. Prerequisite: HTML , CSS , JavaScript Basic of Animation Installation of anime.js: You can download anime.min.js file and directly use it. Just google anime.js CDN and you will get the link and just put it in your script tag. <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.0/anime.min.js"></script> Let's talk about some basic animation. So there are a lot of different properties we have to know about when we are dealing with it. Targets: The target includes a reference to the part we want to animate that can be HTML tag, class or id element and lot more that we will see in another article. Properties: These are those properties that can be animate when dealing with CSS, JS, SVG. Properties Parameters: This includes properties parameters such as duration, delay, end-delay, easing, round, and many more. Animation Parameter: This include animation related parameters such as direction, loop, autoplay And there are other things such as keyframes, timeline, etc. Now let's see an example to show how easy it is to animate things using Anime.js . Example: We created a div with some height, width, and background color that's basic CSS. The JavaScript part. First, we have to write everything in anime function and pass objects of properties. The target part is where we wanna animate (here its div) and translateX is (if you know about animation it means to) 150 toward x-axis from current position. The height and width are what we wanna achieve at 150 toward the x-axis. The easing linear means to translate it literally the size increasing and decreasing in this case. The duration is the time for animation (in ms). html <!DOCTYPE html> <html> <head> <title>First animation of animejs</title> <script src= "https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.0/anime.min.js"> </script> </head> <body> <div style="background: blue; height: 40px; width: 40px;"> </div> <script> let animation = anime({ targets: "div", translateX: 150, height: "80px", width: "80px", duration: 2000, easing: "linear", direction: "alternate", loop: true, }); </script> </body> </html> Output: Comment More infoAdvertise with us Next Article Introduction to Anime.js I iamsahil1910 Follow Improve Article Tags : JavaScript Web Technologies CSS Anime.js Similar Reads p5.js Introduction p5.js is a JavaScript library used for creative coding. It is based on Processing which is a creative coding environment. The main focus of processing is to make it easy as possible for beginners to learn how to program interactive, graphical applications, to make a programming language more user-fr 2 min read Introduction to Javascript Engines JavaScript is a scripting language and is not directly understood by computer but the browsers have inbuilt JavaScript engine which help them to understand and interpret JavaScript codes. These engines help to convert our JavaScript program into computer-understandable language. A JavaScript engine 4 min read Introduction to Three.js Did you ever imagine that how these graphics and games are run on a web-browser? What is the main technology behind it? Off course it is not possible by just using HTML and CSS. In previous days we used WebGL for this task. WebGL(Web graphics Library) is JavaScript API which is used to render the 3- 4 min read Introduction To Phaser.js Phaser.js is a fast, free, and open-source JavaScript framework used for creating games for desktop and mobile platforms. It provides an extensive library of functions that enable developers to build games with rich graphics, physics, sound, and animationsWhat is Phaser.js?Phaser.js is a popular HTM 6 min read Introduction to JavaScript JavaScript is a versatile, dynamically typed programming language used for interactive web applications, supporting both client-side and server-side development, and integrating seamlessly with HTML, CSS, and a rich standard library.JavaScript is a single-threaded language that executes one task at 7 min read Like