Created
November 11, 2016 07:13
-
-
Save MacKentoch/4297f1605332b8d771a9df23e8219485 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ReactJS: | |
| <Motion style={{x: spring(this.state.open ? 400 : 0)}}> | |
| {({x}) => | |
| <div style={styles.container}> | |
| <div | |
| style={ | |
| { | |
| ...styles.movingCube, | |
| WebkitTransform: `translate3d(${x}px, 0, 0)`, | |
| transform: `translate3d(${x}px, 0, 0)` | |
| } | |
| } | |
| /> | |
| </div> | |
| } | |
| </Motion> | |
| // React Native: | |
| <Motion style={{x: spring(this.state.open ? 270 : 0)}}> | |
| {({x}) => | |
| <View style={styles.movingCubeContainer}> | |
| <View | |
| style={[ | |
| styles.movingCube, | |
| { | |
| transform: [{translateX: x}] | |
| } | |
| ] | |
| } | |
| /> | |
| </View> | |
| } | |
| </Motion> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment