An Animation Library Based on Small But Powerful CSS Transitions | Anim-x

Anim-x animation is identified by a name and applied to an element by adding or removing categories respectively. This animation library helps you easily control CSS-enabled animations applied to DOM elements.

Anim-x’s goal is to organize these classes to allow flexible use of these animation classes.

Declarative shared-element Transitions Between Pages for Vue.js

How to make use of it:

1. Download the package and import the mandatory modules as follows:

import {animateElement, animateStack, getAnimationDuration} from "./src/index.js";

2. Apply a ‘pulse’ effect to a component:

<div id="example-1">
  <div class="square"></div>
</div>
#example-1 .animate-pule-active {
  transition: ease-out 0.3s transform;
}

#example-1 .animate-pule {
  transform: scale(0.5)
}

#example-1 .animate-pule-end {
  transform: scale(1)
}
let element = document.querySelector("#example-1 .square")
await animateElement(element, "pulse")

3. You also can apply a number of CSS animations to a component:

<div id="example-2">
  <div class="square"></div>
</div>
#example-2 .square {
  position: relative;
  top: 0;
  left: 0;
}

#example-2 .animate-slide-right, #example-2 .animate-slide-left {
  transition: ease 0.3s left;
}

#example-2 .animate-slide-right, #example-2 .animate-slide-left-end {
  left: -200%;
}

#example-2 .animate-slide-right-end, #example-2 .animate-slide-left {
  left: 200%;
}
let element = document.querySelector("#example-2 .square")
await animateElement(element, "slide-right")
await animateElement(element, "slide-left")

4. The following instance reveals how one can control the animation utilizing promise.

<div id="example-3" class="content">
  <div class="card"></div>
  <div class="card"></div>
  <div class="card"></div>
  <div class="card"></div>
  <div class="card"></div>
  <div class="card"></div>
</div>
#example-3 .animate-enter-active, #example-3 .animate-leave-active {
  transition: ease-out 0.5s all;
}

#example-3 .animate-enter-step,
#example-3 .animate-leave-step {
  transition-delay: 100ms;
}

#example-3 .animate-enter-step:last-child {
  transition-delay: 150ms;
}

#example-3 .animate-enter {
  transform: translateY(50px);
  opacity: 0;
}

#example-3 .animate-leave-end {
  opacity: 0;
}

#example-3 .hidden {
  opacity: 0;
}
let elements = Array.from(document.querySelectorAll("#example-3 .card"))
elements.forEach(el => el.classList.remove("hidden"))
await animateStack("enter", elements)
await new Promise(res => setTimeout(res, 2000))
await animateStack("leave", elements)
elements.forEach(el => el.classList.add("hidden"))
await new Promise(res => setTimeout(res, 500))

5. Apply a delay to the animation.

await animateElement(element, "pulse",{
      extraDelay: 200
})

6. Determine whether or not to reject the promise if the animation is cancelled with clearAnimation() the technique.

await animateElement(element, "pulse",{
      rejectOnCancel: true
})

Handling CSS Animations With Promise Support, Anim-x Plugin/Github

Anim-x-Demo


See Demo And Download

Official Website(LTBL-Studio): Click Here

This superior jQuery/javascript plugin is developed by LTBL-Studio. For extra Advanced Usages, please go to the official website.

Related Posts

Table-of-Contents-for-the-Long-Document

Create a List-Based Table of Contents for the Long Document | HTML-Contents

Creates a table of contents in the DOM element optionally linked with anchors. HTML Content is a self-contained JavaScript library that dynamically creates a semantic and environmentally…

Create-a-Hierarchical-Table-of-Contents

How to Create a Hierarchical Table of Contents in Javascript Plugin | Easy-TOC

Hierarchical Table Of Contents is a vanilla JavaScript plugin used to create a hierarchical, list-based table of contents for long web content. Easy-TOC is a lightweight and…

multiple-select-dropdown-bootstrap

Optimized for Bootstrap 5 Dropdown Select Box | dselect

dselect is a JavaScript library that adds advanced features (such as direct search, dynamic generation, and field validation) to native Bootstrap 5 select boxes. Features: Placeholder Multiple…

Flow-Chart-In-CSS-&-HTML

Best Pure Flow Chart In CSS & HTML | CSS Process Diagram

Process Flow Chart HTML CSS gives a basic layout of the operations diagram. It’s a proof of concept that can be achieved with just CSS and HTML….

Bootstrap-4-dropdown-plugin

Bootstrap 4 Dropdown Plugin with jQuery | Bootstrap-Select

Bootstrap-select is a jQuery plugin that uses the Bootstrap.js dropdown menu to design and offer add-ons to standard selection elements. JQuery plugin that brings select items into…

Simple-Currency-Converter

How to Create a Simple Currency Converter In JavaScript

The currency converter is a simple project to get you started with basic JavaScript. An easy but configurable, multilingual online currency converter that permits the person to shortly…