Skip to content

Instantly share code, notes, and snippets.

@rfpuyana
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rfpuyana/ecf13705ea70b59fb28e to your computer and use it in GitHub Desktop.
Save rfpuyana/ecf13705ea70b59fb28e to your computer and use it in GitHub Desktop.
Framer.js: Multilayer
#needs the variable CurrentExpanded as an external one
currentExpanded = null
class MultiLayer
@arrayCounter
constructor: (@imgArray) ->
for item in @imgArray
#item.superLayer=@container
item.opacity = 0
@imgArray[0].opacity=1
Switch: () ->
imgArray = @imgArray
for item in imgArray
item.opacity = 0
item.y = 10000
imgArray[currentExpanded].opacity = 1
imgArray[currentExpanded].y = 0
currentExpanded += 1
if currentExpanded == imgArray.length
currentExpanded = 0
Tap: ->
imgArray = @imgArray
counter = 0
imgArray[0].on Events.Click, ->
if counter < imgArray.length-1
counter +=1
else
counter = 0
for item in imgArray
item.opacity = 0
imgArray[counter].opacity = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment