Skip to content

Instantly share code, notes, and snippets.

@joshuacrowley
Last active May 12, 2017 16:48
Show Gist options
  • Select an option

  • Save joshuacrowley/1771eeed99e2040c189f07d84e081af5 to your computer and use it in GitHub Desktop.

Select an option

Save joshuacrowley/1771eeed99e2040c189f07d84e081af5 to your computer and use it in GitHub Desktop.

Revisions

  1. joshuacrowley revised this gist Jul 18, 2016. 1 changed file with 10 additions and 5 deletions.
    15 changes: 10 additions & 5 deletions buttonToggle.coffee
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,16 @@
    for button in sketch.headerBttn.children
    toggleBatch = (arrayOfLayers) ->
    for button in arrayOfLayers
    button.states.add
    off:
    opacity: 0.5
    opacity: 0.30
    index : 19
    on:
    opacity: 1
    button.onTap (event, layer) ->
    others = _.without(sketch.headerBttn.children, layer)
    index : 20
    button.states.switchInstant("off")
    button.onTap (event, layer) ->
    others = _.without(arrayOfLayers, layer)
    for other in others
    other.states.switch("off")
    button.states.switch("on")
    layer.states.switch("on")
    arrayOfLayers[0].states.switch("on")
  2. joshuacrowley revised this gist Jul 18, 2016. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions buttonToggle.coffee
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,11 @@
    for button in sketch.headerBttn.children
    do (button) ->
    button.states.add
    off:
    opacity: 0.5
    on:
    opacity: 1
    button.onTap ->
    others = _.without(sketch.headerBttn.children, button)
    button.onTap (event, layer) ->
    others = _.without(sketch.headerBttn.children, layer)
    for other in others
    other.states.switch("off")
    button.states.switch("on")
  3. joshuacrowley created this gist Jul 16, 2016.
    12 changes: 12 additions & 0 deletions buttonToggle.coffee
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    for button in sketch.headerBttn.children
    do (button) ->
    button.states.add
    off:
    opacity: 0.5
    on:
    opacity: 1
    button.onTap ->
    others = _.without(sketch.headerBttn.children, button)
    for other in others
    other.states.switch("off")
    button.states.switch("on")