Giter VIP home page Giter VIP logo

twc-animate's Introduction

@micahfang/twc-animate

GitHub repo size npm bundle size (scoped) npm

NPM GitHub package.json version

A TailwindCSS plugin provides a variety of commonly used animation effects.

Examples

Table of Contents

Install

Before you use @micahfang/twc-animate you should check your tailwindcss version is larger than 3.0.

pnpm add @micahfang/twc-animate -D
# or use yarn
yarn add @micahfang/twc-animate -D
# or use npm
npm install @micahfang/twc-animate -D

Usage

Update your tailwind.config.js

module.exports = {
  content: ['./src/**/*.{js,ts,jsx,tsx}'],
  plugins: [require('@micahfang/twc-animate')], // require the plugin,
}

See more examples.

Animate duration times

ani-duration-[times]

example

const AniCount = () => (
  <>
    <div className="ani-shake ani-duration-200"></div>
    <div className="ani-shake ani-duration-300"></div>
    <div className="ani-shake ani-duration-[100ms]"></div>
    <div className="ani-shake ani-duration-1000"></div>
  </>
)

Animate repeat count

ani-count-[count]

example

const AniCount = () => (
  <>
    <div className="ani-shake ani-count-1"></div>
    <div className="ani-shake ani-count-2"></div>
    <div className="ani-shake ani-count-[100]"></div>
    <div className="ani-shake ani-count-infinite"></div>
  </>
)

Shake animation

If you want to shake an element, you can yse add ani-shake class to your element.

example

const ShakeEle = () => <div className="ani-shake ani-count-2"></div>

The ani-shake class will add an animation to the div. Because of ani-count-2 class This animation will repeat twice.

Different types of shake

  • ani-shake: rotate animate
  • ani-shake-horizontal: translate x
  • ani-shake-vertical: translate y

See more examples.

Animate duration times

ani-duration-[times]

example

const AniCount = () => (
  <>
    <div className="ani-shake ani-duration-200"></div>
    <div className="ani-shake ani-duration-300"></div>
    <div className="ani-shake ani-duration-[100ms]"></div>
    <div className="ani-shake ani-duration-1000"></div>
  </>
)

Animate repeat count

ani-count-[count]

example

const AniCount = () => (
  <>
    <div className="ani-shake ani-count-1"></div>
    <div className="ani-shake ani-count-2"></div>
    <div className="ani-shake ani-count-[100]"></div>
    <div className="ani-shake ani-count-infinite"></div>
  </>
)

Shake animation

If you want to shake an element, you can yse add ani-shake class to your element.

example

const ShakeEle = () => <div className="ani-shake ani-count-2"></div>

The ani-shake class will add an animation to the div. Because of ani-count-2 class This animation will repeat twice.

Different types of shake

  • ani-shake: rotate animate
  • ani-shake-horizontal: translate x
  • ani-shake-vertical: translate y

See more examples.

License

MIT © Micah Fang.

twc-animate's People

Contributors

micahfang avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.