I have the issue of overlap 2 animations if the previous is really long.

I'd like to stop the current animation for set a new animation with different parameters.

var anima = ol.animation.pan({
        duration: 5000,
        source: map.getView().getCenter()
map.getView().setCenter(ol.proj.transform([lng, lat], 'EPSG:4326', 'EPSG:3857'));

How can I stop the current ol.animation with openlayers 3? I think with duration = 0, but I don't know to access that property :$

  • I can't see any documented way of doing this (the feature is only makred as experimental after all). I would love to stop the current animation on any map click. – zod Aug 20 '15 at 12:37
  • I think the animation panning is independent of the actual map's center (which is set immediately after setCenter), so if you did manage to stop mid animation, you would have to work out the maps physical pan/zoom and set those values. – zod Aug 20 '15 at 12:37
  • I think a custom pan function, that tracked the real location and was cancelable might be the way to go, but I am not sure if returning "false" is sufficient to cancel the animation. – zod Aug 20 '15 at 12:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.