In some cases, setBounds when set to duration is not animated, but transferred instantly.

var myMap = new ymaps.Map('map', { bounds: [[55.927508859617696, 37.8442784658615], [55.929851911467324, 37.84709478532714]] }); setTimeout(function() { myMap.setBounds([[55.72450466, 37.64446792], [55.99352968, 37.97332318]], {duration: 5000}) .then(function(val) { console.log('fine ', val); }, function(err) { console.log('err ', err); }); }, 2000); 

https://jsfiddle.net/038jobLr/

What am I doing wrong?

  • Can loading maps be late? What if you also return the creation of a card with a promise, and then initialize all other actions? - Alexey Zolotov
  • @AlexeyZolotov If the difference between the zooms is not so big then the similar code passes normally. If timeout is set at 20,000, everything is the same. - Yevgeny Gritskevich

1 answer 1

Increase the maxAnimationZoomDifference option maxAnimationZoomDifference the map. For example, before Infinity , if you want a smooth zoom to always occur.

 var myMap = new ymaps.Map('map', { bounds: [/* ... */] }, { maxAnimationZoomDifference: Infinity });