React.animate

state animation plugin for react.js
Alternatives To React.animate
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
React Spring26,7091,4641,76510 hours ago382September 26, 2023102mitTypeScript
✌️ A spring physics based React animation library
React Three Fiber24,613380a day ago210December 03, 202333mitTypeScript
🇨🇭 A React renderer for Three.js
Motion20,6471184,0343 days ago960December 01, 2023347mitTypeScript
Open source, production-ready animation and gesture library for React
Lottie React Native16,2776,3222658 days ago77November 14, 202329apache-2.0Kotlin
Lottie wrapper for React Native.
React Content Loader12,7683094789 months ago70March 12, 20239mitTypeScript
⚪ SVG-Powered component to easily create skeleton loadings.
Auto Animate10,30068a month ago15November 06, 202335mitTypeScript
A zero-config, drop-in animation utility that adds smooth transitions to your web app. You can use it with React, Vue, or any other JavaScript application.
React Transition Group9,77147,7156,9338 months ago44August 01, 2022218otherJavaScript
An easy way to perform animations when a React component enters or leaves the DOM
React Native Animatable9,6022,130363a month ago24October 26, 2023169mitJavaScript
Standard set of easy to use animations and declarative transitions for React Native
React Native Reanimated7,9254,8471,77913 hours ago320December 02, 2023297mitTypeScript
React Native's Animated library reimplemented
React Move6,56832383a year ago60June 13, 202125mitJavaScript
React Move | Beautiful, data-driven animations for React
Alternatives To React.animate
Select To Compare


Alternative Project Comparisons
Readme

React.Animate

A simple state animation mixin for React.js

Philosophy

React.Animate is a different approach to animate based on state rather than direct DOM mutation using $.animate or similar.

While it's great that you can use refs to get DOM nodes after render, the biggest benefit to using react is that there is always a direct, observable, and testable relationship between component props, state, and the rendered output.

Mutating the dom directly is an antipattern.

What we really want to animate is not the DOM, it's component state.

If you think about animation as a transition from one state value from another, you can just interpolate state over an interval, and your component can rerender precisely in response to the current component state at every step.

At it's most simple, React.Animate allows you to transition between one state and another over a set interval. The implementation supports the same syntax as $.animate.

you can pass either

this.animate(properties [, duration ] [, easing ] [, complete ] );

or

this.animate(key, value [, duration ] [, easing ] [, complete ] );

Example

React.Animate can be included in any React class by adding it to the mixins array

By animating state instead of the DOM directly, we can define logic that acts during certain parts of our animations.

var component = React.createClass({
  mixins: [React.Animate],
  getInitialState: function() {
    return {
      width: 100
    };
  },
  render: function() {
    var heightBounds = [50, 100];

    return React.DOM.div({
      style: {
        width: this.state.width,
        height: Math.min(heightBounds[1], Math.max(heightBounds[0], this.state.width / 2))
      },
      onClick: this.randomSize
    });
  },
  randomSize: function() {
    this.animate({
      width: _.random(20, 300)
    }, 500, function() {
      console.log("random size reached!");
    });
  }
});

view in jsfiddle

Installation

React.Animate can be installed with bower using

bower install react.animate --save

React.Animate can be installed with npm using

npm install react.animate --save

Both will automatically pull the required React and Underscore dependencies.

to use React.Animate, include it in your page or build process after React and Underscore

Dependencies

easing functions.

Popular Reactjs Projects
Popular Animation Projects
Popular Web User Interface Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Javascript
Reactjs
Animation
Dom
Transition
Animate
Underscore