Git Product home page Git Product logo

react-native-stagger-animation's Introduction

React Native Stagger Animation

Battle Tested ✅ npm version npm Platform - Android and iOS License: MIT

Demo Demo

React native stagger animation
Use to create stagger animation effect for children view


➤ Installation

Add the dependency:

➤ Peer dependencies

  • Using animated-pose

➤ Usage

import StaggerAnimation, { Transition } from 'react-native-stagger-animation';

/**
 * Create stagger animation for header group
 */
const AnimatedStaggerHeader = StaggerAnimation.createAnimatedStagger();
const AnimatedViewHeader = StaggerAnimation.createAnimatedView({
  transitionType: 'easeInOut',
  duration: 900,
});

render() {
  // Visible state
  const { isVisible } = this.state;
  return (
    <Transition delayChildrenIn={150}>
      {isVisible && (
        <AnimatedStaggerHeader key="a">
          <AnimatedViewHeader>
            <Text>Hi Stephen</Text>
            <Image
              source={require('../assets/avatar.jpg')}
            />
          </AnimatedViewHeader>
          <AnimatedText>
            What sport are you going to play today ?
          </AnimatedText>
        </AnimatedStaggerHeader>
      )}
    </Transition>
  )
}

Note : The Transition is using to pass any props stagger animation

➤ Example

  • Check the example folder, then type to the terminal
expo start

➤ Configuration

Property Type Default Description
createAnimatedStagger function () => null Create the animate stagger wrapper view
createAnimatedView function ()=>null Create View animation component
createAnimatedText function ()=>null Create Text animation component

➤ Props

Transition type

  • spring,
  • linear,
  • easeIn, easeOut, easeInOut
  • circIn, circOut, circInOut
  • backIn, backOut, backInOut
  • anticipate

Animate Spring configuration

Property Type Default Description
type string linear Create the animate stagger wrapper view
stiffness? number 100 Spring stiffness.
damping? number 10 Strength of opposing force.
velocity? number 0 Initial velocity.
overshootClamping? boolean false Clamps any overshoot beyond the target value.
mass? number 1 Mass of the moving object.
useNativeDriver boolean false Use native driver

Animate other transition type configuration

Property Type Default Description
type string linear Create the animate stagger wrapper view
duration function 300 Total duration of animation, in milliseconds.
useNativeDriver boolean false Use native driver

➤ License

MIT

react-native-stagger-animation's People

Contributors

sieuhuflit avatar

Stargazers

 avatar  avatar  avatar  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.