Skip to content

Instantly share code, notes, and snippets.

@msfeldstein
Last active August 23, 2017 23:18
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msfeldstein/7adea36e5662a6a9ea34 to your computer and use it in GitHub Desktop.
Save msfeldstein/7adea36e5662a6a9ea34 to your computer and use it in GitHub Desktop.
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