How do you guys call an animation (layer.animate) from within an event that is constantly firing, but just once, when certain condition is met for the first time?
I've noticed that when you call an animation repeatedly it behaves oddly :(
I know you can use .isAnimating to check, but was wondering if there is a pattern I should be using instead.
You could use the once function of lodash: https://lodash.com/docs#once
Framer includes lodash
Thanks Jonas, will try this :)
Lodash is awesome :) you could also add a boolean to your layer, essentially mylayer.hasanimated = true, and then mylayer.animate() unless mylayer.hasanimated. If you need it to animate again later, just not immediately, you may also want to consider lodash's debounce/throttle functions. Very handy.
Does that mean everything in that documentation ships with framer,