chromium/tools/perf/page_sets/tough_animation_cases/css_animations_staggered_triggering_by_inserting_new_element.html

<!DOCTYPE html>
<meta name="viewport" content="width=device-width, user-scalable=no">
<link rel="stylesheet" type="text/css" href="resources/animation.css">
<link rel="stylesheet" type="text/css" href="resources/tablet.css">
<script src="resources/perf_test_helper.js"></script>

<container id="container"></container>

<script>
var N = PerfTestHelper.getN(1000);
var duration = 1000;

var targets = [];
function startAnimation(i) {
  if (targets[i])
    targets[i].remove();
  var target = document.createElement('target');
  container.appendChild(target);
  targets[i] = target;
}

requestAnimationFrame(function(t) {
  var base = t;
  var i = 0;

  function staggeredStart(t) {
    var elapsed = t - base;
    for (; i < N && i < N * elapsed / duration; i++) {
      startAnimation(i);
    }
    if (elapsed > duration) {
      PerfTestHelper.signalReady();
      i = 0;
      base = t - (elapsed % duration);
      elapsed = 0;
    }
    requestAnimationFrame(staggeredStart);
  }
  requestAnimationFrame(staggeredStart);
});
</script>