A plugin that provides utilities for animation property.

Overview

tailwindcss-animation-property

A plugin that provides utilities for animation property. Not only does the plugin provide the usual animation properties, these also support dynamic writing using JIT mode, even you can add new properties by using configuration.

The example can be previewed on CodeSandbox: Check out DEMO

If you don't want to write all the keyframes yourself. Try tailwindcss-magic.

Usage

Installation

# npm
npm i tailwindcss-animation-property

# yarn
yarn add tailwindcss-animation-property

Import plugin

Then add the plugin to your tailwind.config.js file:

// tailwind.config.js
module.exports = {
  theme: {
    // ...
  },
  plugins: [
    // ...
    require("tailwindcss-animation-property")(),
  ],
};

Used in HTML element class

<div className="animation-duration-3s"></div>

Used with @apply

@layer components {
  .animation-magic-repeat-2 {
    @apply magic-magic animate-iteration-2;
  }
}
<div className="animation-magic-repeat-2"></div>

Default & Customized animation property

animation-duration

Use the animation-duration-{number}ms or animation-duration-{number}s utilities to sets the length of time that an animation takes to complete one cycle.

defalut:

  • animation-duration-1s -> animation-duration: 1s
  • ...
  • animation-duration-5s -> animation-duration: 5s

JIT mode Example:

  • animation-duration-[100ms] -> animation-duration: 100ms
  • animation-duration-[10s] -> animation-duration: 10s

animation-delay

Use the animation-delay-{number}ms or animation-delay-{number}s utilities to sets the amount of time to wait from applying the animation to an element before beginning to perform the animation.

defalut:

  • animation-delay-0s -> animation-delay: 0s
  • ...
  • animation-delay-5s -> animation-delay: 5s

JIT mode Example:

  • animation-delay-[100ms] -> animation-delay: 100ms
  • animation-delay-[10s] -> animation-delay: 10s

animation-iteration-count

Use the animation-iteration-{number} utilities to sets the number of times an animation sequence should be played before stopping.

defalut:

  • animation-iteration-1 -> animation-iteration-count: 1
  • ...
  • animation-iteration-5 -> animation-iteration-count: 5

JIT mode Example:

  • animation-iteration-[6] -> animation-iteration-count: 6
  • animation-iteration-[10] -> animation-iteration-count: 10

animation-fill-mode

Use the animation-fill-{mode} utilities to sets how a CSS animation applies styles to its target before and after its execution.

defalut:

  • animation-fill-forwards -> animation-fill-mode: forwards
  • animation-fill-backwards -> animation-fill-mode: backwards
  • animation-fill-both -> animation-fill-mode: both
  • animation-fill-none -> animation-fill-mode: none

JIT mode Example:

  • animation-fill-[forwards] -> animation-fill-mode: forwards

animation-direction

Use the animation-direction-{dir} utilities sets whether an animation should play forward, backward, or alternate back and forth between playing the sequence forward and backward.

defalut:

  • animation-direction-normal -> animation-direction: normal
  • animation-direction-reverse -> animation-direction: reverse
  • animation-direction-alternate -> animation-direction: alternate
  • animation-direction-alternate-reverse -> animation-direction: alternate-reverse

animation-timing-function

Use the animation-timing-{function} utilities to sets how an animation progresses through the duration of each cycle.

defalut:

  • animation-timing-linear -> animation-timing-function: linear
  • animation-timing-in -> animation-timing-function: in
  • animation-timing-out -> animation-timing-function: out
  • animation-timing-in-out -> animation-timing-function: in-out
  • animate-steps-start-{1...5} -> animation-timing-function: steps(1...5, jump-start)
  • animate-steps-end-{1...5} -> animation-timing-function: steps(1...5, jump-end)
  • animate-steps-both-{1...5} -> animation-timing-function: steps(1...5, jump-both)
  • animate-steps-none-{1...5} -> animation-timing-function: steps(1...5, jump-none)

JIT mode Example:

  • animation-timing-[linear] -> animation-timing-function: linear
  • animation-timing-[p0,p1,p2,p3] -> animation-timing-function: cubic-bezier(p0, p1, p2, p4);
  • animate-steps-start-[n] -> animation-timing-function: steps(n, jump-start)
  • animate-steps-end-[n] -> animation-timing-function: steps(n, jump-end)
  • animate-steps-both-[n] -> animation-timing-function: steps(n, jump-both)
  • animate-steps-none-[n] -> animation-timing-function: steps(n, jump-none)

animation-play-state

Use the animation-play-{state} utilities to sets whether an animation is running or paused.

defalut:

  • animation-play-paused -> animation-play-state: paused
  • animation-play-running -> animation-play-state: running

Configuration

You can configure custom animation properties by passing parameters to the plugin.

require("tailwindcss-animation-property")({
  animationDuration: ["500ms", "6s", "0.5s"]
  // `animation-duration-500ms`, `animation-duration-6s`, `animation-duration-0.5s`

  animationDelay: ["2000ms", "3s"],
  // `animation-delay-2000ms`, `animation-delay-3s`

  animationIterationCount: [6, 7],
  // `animation-iteration-6`, `animation-iteration-7`

  animationFillMode: ['xxx'],
  // `animation-fill-xxx`

  animationDirection: ['xxx'],
  // `animation-direction-xxx`

  animationTimingFunction: {
    "in-out-cubic": ".65,0,.35,1",
  },
  // `animation-timing-in-out-cubic`

  animationPlayState: ['xxx'],
  // `animation-direction-xxx`

  animationStepsStart: [6,8],
  // `animate-steps-start-6`,`animate-steps-start-8`

  animationStepsEnd: [],  // same as animationStepsStart
  animationStepsBoth: [], // ...
  animationStepsNone: [], // ...
});

FAQ

  • How do I remember so many animation names?
    tailwindcss-animation-property and Tailwind Intellisense work well together, take it easy!

Running

  • locally example
cd example
yarn dev
  • 📦 Package
yarn
yarn build
  • Unit test
npm run test

TODO

  • add the online DEMO

License

MIT

You might also like...

Calculate the price range for property advertised on Domain and Real Estate.

Calculate the price range for property advertised on Domain and Real Estate.

Property Seeker Calculate the price range for property advertised on Domain and Real Estate. Install Chrome Firefox Edge Privacy All searches are perf

Dec 27, 2022

Adds a handy $parent magic property to your Alpine components.

✨ Help support the maintenance of this package by sponsoring me. Alpine $parent Access parent components using a handy $parent magic variable. This pa

Aug 29, 2022

Generate fluid, custom property based design systems on the fly — entirely based on Utopia

Fluid Design Systems With Netlify On-demand Builders A proof of concept demonstrating how Netlify on-demand builders can help generate fluid, custom p

Jan 5, 2023

🤠 Object property paths with wildcards and regexps 🌵

🤠 Object property paths with wildcards and regexps. 🌵 Get/set object properties using: ⛏️ Dot-delimited paths: foo.bar.0.baz ⭐ Wildcards: foo.*, **.

Jan 3, 2023

Explore Alveus Sanctuary with an interactive map and find out more about the different buildings on the property.

Alveus Sanctuary Interactive Map Explore Alveus Sanctuary with an interactive map and find out more about the different buildings on the property. htt

Aug 16, 2022

A jQuery plug-in to notify you of CSS, Attribute or Property changes in an element

selectWatch.js jQuery plug-in gives an opportunity to monitor changes of DOM element's CSS styles, attributes, properties, input element or select ele

Oct 28, 2022

This plugin add a new utilities classes so you can use from 0% to 100%!

This plugin add new utilities classes so you can use from 0% to 100%!

Apr 3, 2022

Basic types & utilities for Strapi v4 and plugin creators

Strapi v4 - Types & utilities Basic set of types and utilities for Strapi v4 and plugins creators A developers goodie for Strapi Headless CMS which pr

Oct 14, 2022

A Tailwind plugin that allows to create multiple groups utilities such as group-card or group-1 and works with Tailwind 3 features and all variations.

Tailwind Labeled Groups A plugin that allows to create multiple groups utilities such as group-card or group-1 and works with Tailwind 3 features and

Nov 21, 2022
Owner
ZXT
A fan of making things secure, fast, scalable, and well-documented.
ZXT
Quick and easy spring animation. Works with other animation libraries (gsap, animejs, framer motion, motion one, @okikio/animate, etc...) or the Web Animation API (WAAPI).

spring-easing NPM | Github | Docs | Licence Quick and easy spring animations. Works with other animation libraries (gsap, animejs, @okikio/animate, mo

Okiki Ojo 34 Dec 14, 2022
🤠 Functional utilities using object property paths with wildcards and regexps 🌵

?? Functional utilities using object property paths with wildcards and regexps. ?? Available functional methods include: ??️ Mapping: map() ?? Merging

ehmicky 29 Dec 15, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
A JavaScript animation plugin for menus. It creates a div that moves when you mouse over an element, giving it an elastic animation.

Lava-Lamp Description: A JavaScript animation plugin for menus. It creates a div that moves when you mouse over an element, giving it an elastic anima

Richard Hung 38 Jun 4, 2022
A plugin that provides utilities for extended backgrounds and borders.

tailwindcss-full-bleed A plugin that provides utilities for extended backgrounds and borders. Demo Installation Install the plugin from npm: npm insta

Doğukan Çavuş 8 Dec 24, 2022
I made countdown birthday and fireworks animation using HTML Canvas, CSS, JS. The fireworks animation gonna come out once the countdown is finished or in other words, "Birthday Time".

Countdown-Birthday-Fireworks-Animation I made countdown birthday and fireworks animation using HTML Canvas, CSS, JS. The fireworks animation gonna com

Mahardika Bayu S.B 19 Dec 31, 2022
Animation library build on top of web animation API (WAAPI)

unanime.js Javascript animation library build on top of web animation API (WAAPI). Learn more about WAAPI: Web animation API Documentation Blog Daniel

Clément Laval 3 Jun 21, 2022
Base provides advanced Promise Queue Manager, Custom Console Logger and other utilities.

Base Base provides frequently used functionality like cutome logger, response helper, Custom Promise and Instance composer. These are used in almost a

PLG Works 14 Jun 14, 2022