Skip to content

Instantly share code, notes, and snippets.

@antonkartashov
Created November 17, 2016 13:14
Show Gist options
  • Save antonkartashov/2552f4f14e26bb88c7bd9db3754c28ed to your computer and use it in GitHub Desktop.
Save antonkartashov/2552f4f14e26bb88c7bd9db3754c28ed to your computer and use it in GitHub Desktop.
scroll = new ScrollComponent
size: Screen.size
scrollHorizontal: false
layers = []
for i in [0..10]
layer = new Layer
parent: scroll.content
height: 300, width: 750
scale: .95
borderRadius: 10
y: i * 300 + 15
image: Utils.randomImage()
backgroundColor: "grey"
layer.onClick (events, clicked) ->
clicked.animate
height: 0
opacity: 0
options: time: .2
for layer in layers
if layer.index > clicked.index then layer.animate
y: layer.y - 300
options:
curve: "spring(250, 20, 0)"
delay: .03 * (layer.index - clicked.index)
layers.push layer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment