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

What is Framer? Join the Community
Return to index
Shane Brown
Posted May 05 - Read on Facebook

I've got a scrollable layer and am listening to the "change:y" / scrollLayer.onMove event, with a bunch of Utils.modulate inside for a sticky header.

I'm having a lag problem since I'm calling a bunch of these Utils.modulate every time the change:y event triggers ( within a certain space) to scale / move my layers .

I've tried modulo to reduce the frequency these are called, but the scrollY value isn't consistent (often something like 2001.2343234234), and Utils.debounce & Utils.throttle seem to break it for some reason.

Does anyone have any tips for fixing this?


Andrew Nalband

Hi Shane, can you share your project so we can take a look?

Kevyn Arnott

It sounds like one approach is to reduce the number of times the modulate is called. For that, you may want to wrap it all in an if statement, and then store the y position of every time it was called. The if statement can check to see if the change:y position has had a significant change from the previous call's y position. You can use Math.round, Math.ceil, or Math.floor to get 2001.234234234 to a whole number. Hopefully that helps.

Read the entire post on Facebook