Created
December 1, 2018 23:59
-
-
Save stakes/6767177cede347937af773b17aaf55b4 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 { Data, animate, Override, Animatable } from "framer"; | |
const data = Data({ scaleValues: [] }); | |
export const Scale: Override = props => { | |
data.scaleValues.push({ id: props.id, scaleValue: Animatable(1) }); | |
return { | |
scale: getValueForId(props.id), | |
onTap() { | |
let valueToScale = getValueForId(props.id); | |
valueToScale.set(0.6); | |
animate.spring(valueToScale, 1); | |
} | |
}; | |
}; | |
const getValueForId = id => { | |
let obj = data.scaleValues.find(function(el) { | |
return el.id.toString() === id; | |
}); | |
return obj.scaleValue; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm trying to set this up for rotations but am having a hell of a time figuring it out. Have any luck with that one?