Last active
August 29, 2015 14:12
-
-
Save rfpuyana/ecf13705ea70b59fb28e to your computer and use it in GitHub Desktop.
Framer.js: Multilayer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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