Skip to content

Instantly share code, notes, and snippets.

@lelandrichardson
Last active August 29, 2015 14:25
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 lelandrichardson/4fb50de584c62c4b7d09 to your computer and use it in GitHub Desktop.
Save lelandrichardson/4fb50de584c62c4b7d09 to your computer and use it in GitHub Desktop.
var Ferrisel = React.createClass({
getInitialState() {
return {
panX: new Animated.Value(0),
panY: new Animated.Value(0)
};
},
render() {
var { pages } = this.props;
var { panX, panY } = this.state;
return (
<PanView
allowScrollX
allowScrollY
lockDirection
panX={panX}
panY={panY}
boundaryY={[MIN, MAX]}
>
{pages.map((page, i) => (
<Animated.Image
source={page.source}
style={{
transform: [{
translateX: panX
}, {
translateY: panY.interpolate({
inputRange: [...],
outputRange: [...],
easing: ...
})
}, {
scale: panY.interpolate({
inputRange: [...],
outputRange: [...]
})
}]
}}
/>
))}
</PanView>
)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment