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.