Created
December 29, 2018 13:37
-
-
Save ibare/7f92bd9729dd854b320dc849440d35a6 to your computer and use it in GitHub Desktop.
FramerX ToggleButton Study#1.2
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
import { Data, animate, Override, Animatable } from "framer" | |
let isOriginalSize = true | |
const data = Data({ | |
scale: Animatable(1) | |
}) | |
export const ToggleButton: Override = () => { | |
return { | |
scale: data.scale, | |
onTap() { | |
if (isOriginalSize === true) { | |
animate.spring(data.scale, 0.5) | |
isOriginalSize = false | |
} else { | |
animate.spring(data.scale, 1) | |
isOriginalSize = true | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment