This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Alex Miles
Posted Dec 01 - Read on Facebook

Is there a way to programmatically create laters? I'm a coffeescript noob :/

6 Comments

Min-Sang Choi

views = []

slider = (slides) ->
# Create wrapper
paginated = new Layer width: deviceWidth * slides, height: deviceHeight, x: 0
paginated.draggable.enabled = true
paginated.draggable.speedY = 0

for i in [0...slides]
# Create views
view = new Layer width: deviceWidth, height: deviceHeight, backgroundColor: randomColor, x: slides * deviceWidth, superLayer: paginated
views.push(view)

slider(3)

Min-Sang Choi

There would be other ways to create it, but I do it this way. :-)

Alex Miles

Thanks!

Ed Chao

i do it like Min-Sang Choi too

Giovanni Caruso

would it be possibile to assign different images (or imported layers) instead of "backgroundColor: randomColor"?

Noam Elbaz

just add --> image: "images/image" + i + ".png" and you can loop through images, or you can loop through an array of images if the names are not consistent.

Read the entire post on Facebook