Last active
August 23, 2017 23:18
-
-
Save msfeldstein/7adea36e5662a6a9ea34 to your computer and use it in GitHub Desktop.
Just a couple guys in a view
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
class CompoundLayer extends Layer | |
@define "selectedTab", | |
get: -> @_selectedTab || 0 | |
set: (p) -> | |
@_selectedTab = p | |
for tab, i in @tabs | |
tab.opacity = 1 - Math.abs(i - p) | |
constructor: (opts) -> | |
super opts | |
@tab1 = new Layer | |
backgroundColor: "red" | |
opacity: 0 | |
@tab2 = new Layer | |
backgroundColor: "blue" | |
x: 100 | |
opacity: 0 | |
@tab3 = new Layer | |
backgroundColor: "green" | |
x: 200 | |
opacity: 0 | |
@tabs = [@tab1, @tab2, @tab3] | |
@on Events.Click, () => | |
@animate | |
properties: | |
selectedTab: 1 + @selectedTab | |
curve: "bezier-curve" | |
@selectedTab = 0 | |
new CompoundLayer | |
backgroundColor: "white" | |
width: 300 | |
height: 300 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment