<!DOCTYPE html>
<meta name="viewport" content="width=device-width, user-scalable=no">
<link rel="stylesheet" type="text/css" href="resources/tablet.css">
<script src="resources/perf_test_helper.js"></script>
<script src="resources/web_animations_api_check.js"></script>
<container id="container"></container>
<script>
var N = PerfTestHelper.getN(1000);
var duration = 1000;
function startAnimation(element) {
var player = element.animate([
{opacity: 0},
{opacity: 1},
], duration);
player.onfinish = function() {
startAnimation(element);
}
}
function addElement() {
var target = document.createElement('target');
container.appendChild(target);
startAnimation(target);
}
requestAnimationFrame(function(t) {
var base = t;
var i = 0;
requestAnimationFrame(function staggeredStart(t) {
elapsed = t - base;
for (; i < N * Math.min(1, elapsed / duration); i++) {
addElement();
}
if (i < N) {
requestAnimationFrame(staggeredStart);
} else {
PerfTestHelper.signalReady();
}
});
});
</script>