Skip to content

Instantly share code, notes, and snippets.

@antonkartashov
Last active November 4, 2015 22:14
Show Gist options
  • Save antonkartashov/cc13fb0a1f8a7d7f89b2 to your computer and use it in GitHub Desktop.
Save antonkartashov/cc13fb0a1f8a7d7f89b2 to your computer and use it in GitHub Desktop.
marginLeft = 50
marginTop = 40
redLine = new Layer
x: 1000 + marginLeft, width: 1, height: 1500
backgroundColor: "red", opacity: .2
for i in [0..75] by 3
for j in [0..i] # divisions
div[j] = new Layer
y: ((75 - i) / 3) * 50 + marginTop
height: 4
sliceWidth1 = 16
sliceWidth2 = 1000 / (i + 1)
if i * 16 >= 1000 then div[j].props =
width: sliceWidth1 - 2
x: sliceWidth1 * j + marginLeft
else if i * 16 < 1000
if sliceWidth2 <= sliceWidth1 * 3 then div[j].props =
width: sliceWidth2 - 2
x: sliceWidth2 * j + marginLeft
else if sliceWidth2 > sliceWidth1 * 3 then div[j].props =
width: sliceWidth1 * 3 - 2
x: (sliceWidth1 * 3) * j + marginLeft
divs.push div[j]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment