Skip frames when minimum frame rate is not reached
The new minFrameRate option is used to make sure that an animation does not run longer than the time calculated from that frame rate. Time is made up by skipping frames, i.e. skipping execution of the eachStep callback.
This commit is contained in:
@@ -74,6 +74,36 @@
|
||||
tween.stop();
|
||||
t.ok(tween.animationId != null, "stop method doesn't do anything if tween isn't running");
|
||||
}
|
||||
|
||||
function test_Tween_skip(t) {
|
||||
t.plan(2);
|
||||
|
||||
var tween = new OpenLayers.Tween();
|
||||
var log1 = 0;
|
||||
tween.start({count: 0}, {count: 10}, 10, {
|
||||
callbacks: {
|
||||
eachStep: function() {
|
||||
log1++;
|
||||
}
|
||||
},
|
||||
minFrameRate: 10000
|
||||
});
|
||||
|
||||
var log2 = 0;
|
||||
tween.start({count: 0}, {count: 10}, 10, {
|
||||
callbacks: {
|
||||
eachStep: function() {
|
||||
log2++;
|
||||
}
|
||||
},
|
||||
minFrameRate: 1
|
||||
});
|
||||
|
||||
t.delay_call(0.8, function() {
|
||||
t.eq(log1, 0, 'all frames skipped at a frame rate of 10000');
|
||||
t.eq(log2, 11, 'no frames skipped at a frame rate of 1');
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
Reference in New Issue
Block a user