Last active
May 13, 2018 21:16
-
-
Save drcmda/6103c1252bfe6445334d31f2b6a0ab40 to your computer and use it in GitHub Desktop.
This file contains 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
import React from 'react' | |
import { Spring, config } from 'react-spring' | |
import AnimatedButton from './AnimatedButton' | |
const Animation = props => { | |
const { top, left, width, height } = props.pictureRef.current.getBoundingClientRect() | |
return ( | |
<Spring | |
native | |
config={config.wobbly} | |
from={{ opacity: 1 }} | |
to={{ | |
borderRadius: props.isOpen ? `0%` : `50%`, | |
top: props.isOpen ? top : window.innerHeight - 130, | |
left: props.isOpen ? left : 25, | |
transform: `scale(${props.isOpen ? width / 100 : 1}, ${props.isOpen ? height / 100 : 1})` | |
}}> | |
{styles => <AnimatedButton {...props} style={styles} />} | |
</Spring> | |
) | |
} | |
export default Animation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment