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

What is Framer? Join the Community
Return to index
Andy Jakubowski
Posted Jun 01 - Read on Facebook

Is there a way to switch states of a layer only if it is not being animated? I change layer states on DragStart, and later conditionally in Drag. These conditionals interfere with the initial DragStart animation.

Do you know how to overcome this?
gif (watch white square): http://www.gfycat.com/ConcernedChiefIndri
project: http://share.framerjs.com/1usxhh5mnlts/

Thanks a lot!

2 Comments

Benjamin Den Boer

Hey Andy Jakubowski - yes, you can include a little flag within your DragMove event that checks whether or not jaws is animating. Like this:

unless jaws.isAnimating
____updateJaws()

Another thing I think is causing some jumps of your fish layer is that you're listening to the DragEnd event while also having momentum enabled by default. So it'll sometimes switch positions because it's also trying to simulate some momentum. You can easily fix this by disabling it: fish.draggable.momentum = false

Andy Jakubowski

Thanks Benjamin!

Checking for isAnimating did help. I am still getting unexpected behavior, probably because I’m using spring curves and it’s taking a while before Events.AnimationEnd is called. Going to keep poking at it.

Read the entire post on Facebook