0.0.3 • Published 5 years ago

@react-efficiency/animate v0.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

Installation

yarn yarn add @react-efficiency/animate

npm npm install @react-efficiency/animate --save

Features

Time dynamic generation of transition all {time}ms ease-in-out

Simple example

import Animate from '@react-efficiency/animate'
import * as React from 'react'

export const Demo: React.FunctionComponent<any> = () => {
  Const [state, setState] = React.useState({ in: false })

  Const startAnimate = () => {
    setState({ in: !state.in })
  }

  Return (
    <div>
      <Animate in={state.in} animateKey={['fade']}>
        <div>content</div>
      </Animate>

      <button onClick={startAnimate}>animate</button>
    </div>
  )
}

Props extends Partial

propstypedesc
animateKeystring[]Animated keys, can be combined, reference animateKey
animateCssModuleobjectcssModule

Other props reference TransitionProps

Animation status

Refer to TransitionProps

  • entered
  • entering
  • exited
  • exiting
  • unmounted

animateKey

CSS definition for each state

.animateKey {
  Opacity: 0;
 
  &.animateKey--entering {
    Opacity: 0;
  }

  &.animateKey--entered {
    Opacity: 1;
  }
}