Skip to content

Instantly share code, notes, and snippets.

@RayPS
Created August 25, 2017 11:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RayPS/bfdfc3cb48f7974ac2c9cdb92ec53476 to your computer and use it in GitHub Desktop.
Save RayPS/bfdfc3cb48f7974ac2c9cdb92ec53476 to your computer and use it in GitHub Desktop.
Framer-Layer-Stack
Array::stack = (spacing = 0) ->
for layer, index in this
layer.y = this[index-1]?.maxY
layer.y += spacing
# Example:
bg = new BackgroundLayer
for i in [0...10]
new Layer
parent: bg
width: Utils.randomNumber(50, 200)
height: Utils.randomNumber(10, 100)
backgroundColor: Utils.randomColor()
bg.onTap ->
this.children.stack()
@RayPS
Copy link
Author

RayPS commented Aug 25, 2017

2017-08-25 19_08_18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment