Skip to content

Instantly share code, notes, and snippets.

@steveruizok
Created October 23, 2017 05:42
Show Gist options
  • Save steveruizok/89a031346605fd12c1d5de72f0f54b3d to your computer and use it in GitHub Desktop.
Save steveruizok/89a031346605fd12c1d5de72f0f54b3d to your computer and use it in GitHub Desktop.
A simple button wrapper.
buttonWrapper = (layer) ->
layer.states =
default:
brightness: 100
opacity: 1
hover:
brightness: 130
opacity: 1
down:
brightness: 82
opacity: 1
disabled:
brightness: 100
opacity: .7
layer.onTapStart ->
layer.animateStop()
layer.animate "down"
layer.onTapEnd ->
layer.animateStop()
layer.animate "hover"
layer.onMouseOver ->
layer.animateStop()
layer.animate "hover"
layer.onMouseOut ->
layer.animateStop()
layer.animate "default"
# implementation
layer = new Layer
animationOptions:
time: .15
buttonWrapper(layer)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment