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

What is Framer? Join the Community
Return to index
Struan Fraser
Posted Mar 14 - Read on Facebook

Hello lovely Framer people!

I'm having some slight trouble with input spam breaking my animations.

Is there a clean, succinct way to limit input to only trigger an event when no animations are taking place?

8 Comments

George Kedenburg III

sure, theres a bunch of ways to accomplish this... could you share a little more detail on your prototype?

Struan Fraser

Sure, I have an event listener on the arrow keys. Something akin to this,
http://pastebin.com/BM8gCFqR

Struan Fraser

I considered using Utils.delay to last the same amount of time as the animation but it doesn't seem like a very nice way to solve the problem

George Kedenburg III

check out Utils.throttle in the docs :)

Jonas Treub

You could also check if the layer is already animating. Here you have two layer switching states on click but only one at a time: http://share.framerjs.com/fncgbugkkhme/

Struan Fraser

Perfect! Thank you so much! I'll examine the docs a little closer in future :D

Struan Fraser

Thanks Jonas, that's pretty handy too!
I knew about this function and had a feeling that if I used it for every animation it would get a bit heavy. I think the throttling solves a lot of the problems because I'm using a lot of keyboard input.

Struan Fraser

PS. I <3 FRAMER

Read the entire post on Facebook