Last active
August 29, 2015 14:10
-
-
Save johnanthonyevans/68379b4c2e97aa0eca28 to your computer and use it in GitHub Desktop.
Animating an arbitrary property in framers
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
Function::property = (prop, desc) -> | |
Object.defineProperty @prototype, prop, desc | |
class testLayer extends Layer | |
constructor: (options = {}) -> | |
super options | |
@property 'angle', | |
get: -> @_angle | |
set: (angle) -> | |
@_angle = angle | |
@.emit("change:angle", angle) | |
myLayer = new testLayer | |
x: 0 | |
y: 100 | |
width: 50 | |
height: 50 | |
myLayer.angle = 0 | |
myLayer.on Events.Click, -> | |
myLayer.animate | |
properties: {angle:200} | |
curve: "spring(400,10,0)" | |
myLayer.on "change:angle", -> | |
print "updating angle", myLayer.angle |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment