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

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

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

<script>
var N = PerfTestHelper.getN(1000);
var duration = 1000;
var targets = [];
var keyframeValues = [0, 1];

for (var i = 0; i < N; i++) {
  var target = document.createElement('target');
  target._keyframe = 1;
  target.style.opacity = keyframeValues[target._keyframe];
  container.appendChild(target);
  targets.push(target);
}

function startTransition(target, fastForward) {
  target._keyframe ^= 1;
  target.style.opacity = keyframeValues[target._keyframe];
  target.style.transitionDelay = -fastForward + 'ms';
}

requestAnimationFrame(function(time) {
  var startTime = time - duration;
  var step = 0;

  function staggeredStart(time) {
    var elapsed = time - startTime;
    var targetStep = Math.floor(N * elapsed / duration);
    step = Math.max(targetStep - N, step);
    for (; step < targetStep; step++) {
      startTransition(targets[step % N], elapsed - (step / N * duration));
    }
    requestAnimationFrame(staggeredStart);
  }
  staggeredStart(time);
});

PerfTestHelper.signalReady();
</script>