Hi Guys...need a help!
Can I define states inside a function?eg: someFunction = -> layer = new Layer
layer.states.add 1: scale : 20 2: scale: 1
button.onTap -> someFunction()
I was trying something similar to this. But it was not working out! What can do to toggle between states that is defined inside a function?
Yes you can: http://share.framerjs.com/q91lx6ovan00/
Koen Bok But that does not work when I put the layer inside the function, instead I get an error saying can't find variable layer rippleBackground = (event,layer) -> layer = new Layer width: 79 height: 79 borderRadius: "50%" backgroundColor: "#FFBB0E" midX: event.offsetX midY: event.offsetY superLayer: buttonRippleContainer
layer.states.add 1: scale : 20 2: scale: 1 opacity: 0.1
layer.states.animationOptions = time: 1 curve: "ease-out
it's hard to see without indentation, but I guess your 'layer.states.add' is not indented enough; therefor not part of the scope of the rippleBackgroundLayer event-function.