0.3.2 • Published 2 years ago

react-easy-animations v0.3.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

React Easy Animations

React Component to show animated text and objects.

The Component provides regular animation for common object and some animation effects especially for typography like letters and multi-line text.

View Demo and Playground

GIT Link

NPM Link

Installation

Install via npm:

npm i react-easy-animations

Usage

To use react-easy-animations in your react project, wrap the content with the Animation or Typer components and customize the animation with relevant properties.

import React from 'react'
import { Animation, Typer } from 'react-easy-animations'

const MyAnimationComponent = () => {
  return (
    <Animation
      type="animation_type"
      duration="1000ms"
      delay="0s"
      direction="normal"
      timing="ease"
      iteration="infinite"
      fillMode="none"
    >
      Content...
    </Animation>
  )
}

const MyTyperComponent = () => {
  
  return (
      <Typer
          heading="React"
          dataText={[
            'Easy',
            'Breezy',
            'CSS',
            'Animations'
          ]}
          cursorColor="#2196f3"
      />
  )
}

Available properties

PropertyCorresponding Animation PropertyData TypeDefault ValueProperty Unit
typeanimation-nameString"blur"-
durationanimation-durationString"1s"s or ms
delayanimation-delayString"0s"s or ms
directionanimation-directionString"alternate"-
timinganimation-timing-functionString"ease"-
iterationanimation-iteration-countNumber String"infinite"-
fillModeanimation-fill-modeString"none"-

Available animations

  • For entity object and letters

    Common effectsFadeFlipSlide
    blurfadeInflipslideInFromLeft
    bouncefadeInFromLeftflipInslideInFromRight
    effect3DfadeInFromRightflipOutslideOutToLeft
    flashfadeInFromTopflipSlowDownslideOutToRight
    floatfadeInFromBottomflipFromTopslideInFromTop
    glowingfadeOutflipToTopslideInFromBottom
    jellyfadeOutToLeftflipFromBottomslideOutToTop
    pulsefadeOutToRightflipToBottomslideOutToBottom
    shadowfadeOutToTopflipFromLeftToCenter
    spinfadeOutToBottom
    swing
    FoldHangZoomPop
    foldhangOnLeftzoomInpopIn
    unfoldhangOnRightzoomOutpopOut
    RotateShakeSqueeze
    rotateSlowDownshakeMixsqueezeMix
    rotateCWshakeHorizontalsqueezeHorizontal
    rotateACWshakeVerticalsqueezeVertical
  • For multiline texts

    • typewriter

Chain Animation

An string-arry of animation names is used to wrap the animations you want to chain.

import React, { useState } from 'react'
import { Animation } from 'react-easy-animations'

const AnimationsForChaining = ["swing", "flipSlowDown", "fadeOutToBottom", "jelly"]

const AnimationChain = () => {

  const [ animationIndex, setAnimationIndex ] = useState(0)
  const [ animationType, setAnimationType ] = useState(AnimationsForChaining[0])

  const handleChainAnimation = () => {
    setCounter(animationIndex+1)
    setAnimationType(selectedItems[animationIndex+1])
  }

  return (
    <Animation
      onAnimationEnd={handleChainAnimation}
      type={animationType}
      duration="1000ms"
      timing="linear"
      iteration={1}>
      AnimatedText
    </Animation>
  )
}
0.3.2

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.9

2 years ago

0.2.8

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.4

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago