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

What is Framer? Join the Community
Return to index
Eli Beitzuri
Posted Dec 09 - Read on Facebook

My objective: destroy layers after they reach the clipping point of their parent layer

The challenge: these layers were created in a for-loop.

What's the best way to do this? I'm trying to re-purpose a confetti module posted in this group.

for i in [0..exports.density]
fetti = new Layer
width: Utils.randomNumber(20, 60), height: 20
scale: Utils.randomNumber(0.75, 1.25)
backgroundColor: Utils.randomChoice(exports.colors)
x: Utils.randomNumber(0, exports.container.width), y: Utils.randomNumber(-exports.container.height*2, 0)
rotationX: 0
rotationY: 0
superLayer: exports.container

rotationX: Utils.randomNumber(800,1200)
rotationY: Utils.randomNumber(2400,3600)
y: exports.container.height*3
x: Utils.randomNumber(fetti.x-screen.width/2, fetti.x+screen.width/2)
time: exports.speed
curve: "linear"


Eli Beitzuri

Argh, the formatting for the code was stripped out. Here's a screenshot:

George Kedenburg III

is there a reason you want to destroy them at the clip point vs whenever they finish animating?

Read the entire post on Facebook