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

What is Framer? Join the Community
Return to index
Kai Daniels
Posted Jul 26 - Read on Facebook

Hey Frameristas, I need some help with come coffescript logic. Essentially what I'm trying to do is trigger some magic when the y value of a layer falls between a range. What am I doing wrong?

5 Comments

Øyvind Nordbø

Can you share the project? It'll make it a lot easier to provide support.

Mateusz Skoczylas

"if" In Your code on line 18 will be called only once. What You need is to check y position on scroll. Try to pack it to some function which returns true or false and then on scroll event write something like:
if checkYPosition(sketch.Prototype.P1.y)
// here you set opacity

Øyvind Nordbø

If you want to continously watch for a value change, use the layerYouWantToWatch.on "change:propertyYouWantToWatch", -> event listener to get that value.

Kim Does

Also it looks like your condition is incorrect on line 18: you are saying the y should be smaller than 200 AND bigger than 700 at the same time. Which can never be true.

If you want it to be between these values you should flip the sign on the first condition.

Or if you want it to be below OR above this range switch from AND to OR.

Karen Park

I have the same question regarding using y position to trigger certain conditions.

Read the entire post on Facebook