Skip to content

Instantly share code, notes, and snippets.

@carambula
Last active December 27, 2015 20:49
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 carambula/7387609 to your computer and use it in GitHub Desktop.
Save carambula/7387609 to your computer and use it in GitHub Desktop.
Framer demo based on Craig Murray's question in the Framer JS Facebook group: https://www.facebook.com/groups/framerjs/permalink/416670385126705/
var picRef = new ImageView({
x:100,
y:100,
width:400,
height:300,
image: "http://distilleryimage7.ak.instagram.com/310adf44426011e38fa722000a9f1885_8.jpg"
});
var turnLeft_BTN = new View({
x:4,
y:4,
width:50,
height:50,
});
// setup button event for rotate left
cycler = utils.cycle(-90, -180, -270, 0);
turnLeft_BTN.style.cursor = "pointer";
turnLeft_BTN.on("click", function() {
// get the next position value to rotate to
var nextRotate = cycler();
picRef.animateStop()
picRef.rotationZ = picRef.rotationZ <= -270 ? 360 + picRef.rotationZ : picRef.rotationZ
picRef.animate({
properties: {rotationZ:nextRotate},
curve: "spring(220,20,1600)",
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment