Skip to content

Instantly share code, notes, and snippets.

@pleasetrythisathome
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pleasetrythisathome/9648154 to your computer and use it in GitHub Desktop.
Save pleasetrythisathome/9648154 to your computer and use it in GitHub Desktop.
react.animate example
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!");
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment