Skip to content

Instantly share code, notes, and snippets.

@stakes
Created December 1, 2018 23:59
Show Gist options
  • Save stakes/6767177cede347937af773b17aaf55b4 to your computer and use it in GitHub Desktop.
Save stakes/6767177cede347937af773b17aaf55b4 to your computer and use it in GitHub Desktop.
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;
};
@jedhelmers
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment