Animated page transition example ================================ This example demonstrates how to implement animated transitions between routes. Because RRouter isolates routing in one place, this example doesn't actually demonstrates any unique RRouter feature. Instead animated transition is implemented using `CSSTransitionGroup`_, an official addon for doing animations with React. .. _CSSTransitionGroup: http://facebook.github.io/react/docs/animation.html Example ------- .. raw:: html
Implementation -------------- First we need some styles specific for the example:: .App { overflow: hidden; width: 100%; height: 200px; } .AboutPage, .MainPage { padding: 10px; width: 100%; height: 100%; } .AboutPage { background: #60d7a9; } .MainPage { background: #0ac2d2; } Now we describe our animated transition in CSS with CSS transitions (see documentation on `CSSTransitionGroup_` for details):: .moveUp-enter { transition-duration: .3s; transition-property: transform, opacity; transition-timing-function: ease-out; transform: translate3d(0,100%,0); z-index: 10000; } .moveUp-enter.moveUp-enter-active { transform: translate3d(0,0,0); } .moveUp-leave { transition-duration: .3s; transition-property: transform, opacity; transition-timing-function: ease-out; transform: translate3d(0,0,0); opacity: 1; } .moveUp-leave.moveUp-leave-active { transform: translate3d(0,-15%,0); opacity: 0.3; } The required requires: .. jsx:: var React = require('react') var CSSTransitionGroup = React.addons.CSSTransitionGroup var cloneWithProps = React.addons.cloneWithProps var RRouter = require('rrouter') var Routes = RRouter.Routes var Route = RRouter.Route var Link = RRouter.Link and pages: .. jsx:: var MainPage = React.createClass({ render: function() { return (