Use requestAnimationFrame for tweening.

Instead of using an arbitrary interval for tweening, we let the device decide the best animation frame rate.  Where requestAnimationFrame is not available, this will default to 60 fps.
This commit is contained in:
Tim Schaub
2012-01-02 20:52:46 -07:00
parent 5c2af142b6
commit c151b04257
2 changed files with 15 additions and 22 deletions
+5 -5
View File
@@ -36,7 +36,7 @@
}
}
tween.start(start, finish, 10, {callbacks: callbacks});
t.ok(tween.interval != null, "interval correctly set");
t.ok(tween.animationId != null, "animationId correctly set");
t.delay_call(0.8, function() {
t.eq(_start, true, "start callback called");
t.eq(_done, true, "finish callback called");
@@ -49,15 +49,15 @@
t.plan(2);
var tween = new OpenLayers.Tween();
tween.interval = window.setInterval(function() {}, 10);
tween.animationId = OpenLayers.Util.loopAnimation(function() {});
tween.playing = true;
tween.stop();
t.eq(tween.interval, null, "tween correctly stopped");
t.eq(tween.animationId, null, "tween correctly stopped");
tween.interval = window.setInterval(function() {}, 10);
tween.animationId = OpenLayers.Util.loopAnimation(function() {});
tween.playing = false;
tween.stop();
t.ok(tween.interval != null, "stop method doesn't do anything if tween isn't running");
t.ok(tween.animationId != null, "stop method doesn't do anything if tween isn't running");
}
</script>