Remove animations from side-by-side example
This commit is contained in:
@@ -58,14 +58,10 @@
|
|||||||
<dd>drag, arrow keys</dd>
|
<dd>drag, arrow keys</dd>
|
||||||
<dt>Zoom</dt>
|
<dt>Zoom</dt>
|
||||||
<dd>double-click, <code>Shift</code>+double-click, mouse wheel, <code>+</code>/<code>-</code> keys; <code>Shift</code>+drag</dd>
|
<dd>double-click, <code>Shift</code>+double-click, mouse wheel, <code>+</code>/<code>-</code> keys; <code>Shift</code>+drag</dd>
|
||||||
<dt>Rotate</dt>
|
|
||||||
<dd><code>Alt+Shift</code>+drag, <code>r</code> to reset</dd>
|
|
||||||
<dt>Opacity</dt>
|
<dt>Opacity</dt>
|
||||||
<dd><code>o</code>/<code>O</code> keys</dd>
|
<dd><code>o</code>/<code>O</code> keys</dd>
|
||||||
<dt>Visibility</dt>
|
<dt>Visibility</dt>
|
||||||
<dd><code>v</code>/<code>V</code> keys</dd>
|
<dd><code>v</code>/<code>V</code> keys</dd>
|
||||||
<dt>Animations</dt>
|
|
||||||
<dd><code>j</code>/<code>l</code>/<code>m</code>/<code>x</code>/<code>L</code>/<code>M</code>/<code>X</code> keys</dd>
|
|
||||||
<dt>Reset</dt>
|
<dt>Reset</dt>
|
||||||
<dd><code>0</code> key</dd>
|
<dd><code>0</code> key</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|||||||
@@ -56,83 +56,6 @@ keyboardInteraction.addCallback('0', function() {
|
|||||||
layer.setOpacity(1);
|
layer.setOpacity(1);
|
||||||
layer.setVisible(true);
|
layer.setVisible(true);
|
||||||
});
|
});
|
||||||
keyboardInteraction.addCallback('j', function() {
|
|
||||||
var bounce = ol.animation.bounce({
|
|
||||||
resolution: 2 * view.getResolution()
|
|
||||||
});
|
|
||||||
domMap.addPreRenderFunction(bounce);
|
|
||||||
webglMap.addPreRenderFunction(bounce);
|
|
||||||
canvasMap.addPreRenderFunction(bounce);
|
|
||||||
});
|
|
||||||
keyboardInteraction.addCallback('l', function() {
|
|
||||||
var pan = ol.animation.pan({
|
|
||||||
source: view.getCenter(),
|
|
||||||
easing: ol.easing.elastic
|
|
||||||
});
|
|
||||||
domMap.addPreRenderFunction(pan);
|
|
||||||
webglMap.addPreRenderFunction(pan);
|
|
||||||
canvasMap.addPreRenderFunction(pan);
|
|
||||||
view.setCenter(LONDON);
|
|
||||||
});
|
|
||||||
keyboardInteraction.addCallback('L', function() {
|
|
||||||
var start = +new Date();
|
|
||||||
var duration = 5000;
|
|
||||||
var bounce = ol.animation.bounce({
|
|
||||||
resolution: 2 * view.getResolution(),
|
|
||||||
start: start,
|
|
||||||
duration: duration
|
|
||||||
});
|
|
||||||
var pan = ol.animation.pan({
|
|
||||||
source: view.getCenter(),
|
|
||||||
start: start,
|
|
||||||
duration: duration
|
|
||||||
});
|
|
||||||
var rotate = ol.animation.rotate({
|
|
||||||
rotation: 4 * Math.PI,
|
|
||||||
start: start,
|
|
||||||
duration: duration
|
|
||||||
});
|
|
||||||
var preRenderFunctions = [bounce, pan, rotate];
|
|
||||||
domMap.addPreRenderFunctions(preRenderFunctions);
|
|
||||||
webglMap.addPreRenderFunctions(preRenderFunctions);
|
|
||||||
canvasMap.addPreRenderFunctions(preRenderFunctions);
|
|
||||||
view.setCenter(LONDON);
|
|
||||||
});
|
|
||||||
keyboardInteraction.addCallback('m', function() {
|
|
||||||
var pan = ol.animation.pan({
|
|
||||||
source: view.getCenter(),
|
|
||||||
duration: 1000,
|
|
||||||
easing: ol.easing.bounce
|
|
||||||
});
|
|
||||||
domMap.addPreRenderFunction(pan);
|
|
||||||
webglMap.addPreRenderFunction(pan);
|
|
||||||
canvasMap.addPreRenderFunction(pan);
|
|
||||||
view.setCenter(MOSCOW);
|
|
||||||
});
|
|
||||||
keyboardInteraction.addCallback('M', function() {
|
|
||||||
var start = +new Date();
|
|
||||||
var duration = 5000;
|
|
||||||
var bounce = ol.animation.bounce({
|
|
||||||
resolution: 2 * view.getResolution(),
|
|
||||||
start: start,
|
|
||||||
duration: duration
|
|
||||||
});
|
|
||||||
var pan = ol.animation.pan({
|
|
||||||
source: view.getCenter(),
|
|
||||||
start: start,
|
|
||||||
duration: duration
|
|
||||||
});
|
|
||||||
var rotate = ol.animation.rotate({
|
|
||||||
rotation: -4 * Math.PI,
|
|
||||||
start: start,
|
|
||||||
duration: duration
|
|
||||||
});
|
|
||||||
var preRenderFunctions = [bounce, pan, rotate];
|
|
||||||
domMap.addPreRenderFunctions(preRenderFunctions);
|
|
||||||
webglMap.addPreRenderFunctions(preRenderFunctions);
|
|
||||||
canvasMap.addPreRenderFunctions(preRenderFunctions);
|
|
||||||
view.setCenter(MOSCOW);
|
|
||||||
});
|
|
||||||
keyboardInteraction.addCallback('o', function() {
|
keyboardInteraction.addCallback('o', function() {
|
||||||
layer.setOpacity(layer.getOpacity() - 0.1);
|
layer.setOpacity(layer.getOpacity() - 0.1);
|
||||||
});
|
});
|
||||||
@@ -145,22 +68,4 @@ keyboardInteraction.addCallback('r', function() {
|
|||||||
keyboardInteraction.addCallback('vV', function() {
|
keyboardInteraction.addCallback('vV', function() {
|
||||||
layer.setVisible(!layer.getVisible());
|
layer.setVisible(!layer.getVisible());
|
||||||
});
|
});
|
||||||
keyboardInteraction.addCallback('x', function() {
|
|
||||||
var rotate = ol.animation.rotate({
|
|
||||||
rotation: 4 * Math.PI,
|
|
||||||
duration: 2000
|
|
||||||
});
|
|
||||||
domMap.addPreRenderFunction(rotate);
|
|
||||||
webglMap.addPreRenderFunction(rotate);
|
|
||||||
canvasMap.addPreRenderFunction(rotate);
|
|
||||||
});
|
|
||||||
keyboardInteraction.addCallback('X', function() {
|
|
||||||
var rotate = ol.animation.rotate({
|
|
||||||
rotation: -4 * Math.PI,
|
|
||||||
duration: 2000
|
|
||||||
});
|
|
||||||
domMap.addPreRenderFunction(rotate);
|
|
||||||
webglMap.addPreRenderFunction(rotate);
|
|
||||||
canvasMap.addPreRenderFunction(rotate);
|
|
||||||
});
|
|
||||||
domMap.getInteractions().push(keyboardInteraction);
|
domMap.getInteractions().push(keyboardInteraction);
|
||||||
|
|||||||
Reference in New Issue
Block a user