react.js-10-渐隐动画

来源:互联网 发布:钟镇涛破产原因 知乎 编辑:程序博客网 时间:2024/06/05 02:09










var Hello = React.createClass({
getInitialState: function () {
return {
opacity: 1.0
};
},
componentDidMount: function () {
this.timer = setInterval(function () {
var opacity = this.state.opacity;
opacity -= .05;
if (opacity < 0.1) {
opacity = 1.0;
}
this.setState({
opacity: opacity
});
}.bind(this), 100);
},
render: function () {
return (

0 0