我是新来的React,我在项目中添加了react-transition-group,以添加动画效果影响页面之间的过渡。我的CSSTransition没有呈现,我不确定如何解决此问题。
这是我的代码:
var React = require('react');
var {Link} = require('react-router');
import { CSSTransition, TransitionGroup, } from 'react-transition-group';
import mainLogo from '../assets/main-logo.png';
var Intro = React.createClass({
render: function () {
return (
<CSSTransition
// in={state === 'entered'}
timeout={500}
classNames="cd-intro resolutionLoad">
<div>
<div className="cd-login center">
<p className="main-title">Welcome to</p>
<img className="main-ACBGC-logo" src={'http://nightowlmedia.co/images/ACBGC-logo.png'} alt="ACBGC Logo" />
<img className="main-logo" src={mainLogo} alt="Feed AC Logo" />
<p className="main-title">Project</p>
<p className="main-arrow">∨</p>
<Link to="/about" className="enter">ENTER</Link>
</div>
</div>
</CSSTransition>
)
}
});
module.exports = Intro;
我在页面之间转换的CSS如下:
.resolutionLoad-enter {
opacity: 0;
animation: slideIn 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}
.resolutionLoad-leave {
opacity: 1;
animation: slideOut 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}
@keyframes slideIn {
0% {opacity:0;transform:translate3d(0,-50px,0);}
100% {opacity:1;transform:translate3d(0,0,0);}
}
@keyframes slideOut {
0% {opacity:1;transform:translate3d(0,0,0);}
100% {opacity:0;transform:translate3d(0,-50px,0);}
}
我想念什么?任何对此问题的见解将不胜感激。