Skip to content

Instantly share code, notes, and snippets.

@joshuacrowley
Last active May 12, 2017 16:48
Show Gist options
  • Save joshuacrowley/1771eeed99e2040c189f07d84e081af5 to your computer and use it in GitHub Desktop.
Save joshuacrowley/1771eeed99e2040c189f07d84e081af5 to your computer and use it in GitHub Desktop.
Simple toggle button setup for Framer.js
toggleBatch = (arrayOfLayers) ->
for button in arrayOfLayers
button.states.add
off:
opacity: 0.30
index : 19
on:
opacity: 1
index : 20
button.states.switchInstant("off")
button.onTap (event, layer) ->
others = _.without(arrayOfLayers, layer)
for other in others
other.states.switch("off")
layer.states.switch("on")
arrayOfLayers[0].states.switch("on")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment