Add rotateAroundRome to animation example

This commit is contained in:
Éric Lemoine
2014-02-27 10:17:48 +01:00
committed by Frederic Junod
parent 3c86dba3a8
commit 59c3857afd
2 changed files with 12 additions and 0 deletions

View File

@@ -49,6 +49,17 @@ rotateRight.addEventListener('click', function() {
map.beforeRender(rotateRight);
}, false);
var rotateAroundRome = document.getElementById('rotate-around-rome');
rotateAroundRome.addEventListener('click', function() {
var currentRotation = view.getRotation();
var rotateAroundRome = ol.animation.rotate({
anchor: rome,
duration: 1000,
rotation: currentRotation
});
map.beforeRender(rotateAroundRome);
view.rotate(currentRotation + (Math.PI / 2), rome);
}, false);
var panToLondon = document.getElementById('pan-to-london');
panToLondon.addEventListener('click', function() {