Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Just a couple guys in a view
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
You can’t perform that action at this time.