chromium/chrome/test/data/perf/throughput_test_cases/main-impl-animations-no-update-throughput.html

<!doctype html>
<!--
Copyright 2020 The Chromium Authors
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
  <style>
    #mainanim {
      width: 200px;
      height: 200px;
      background-color: red;
      will-change: transform;
    }

    #cssanim {
      width: 200px;
      height: 200px;
      background-color: green;
    }

    @keyframes mymove {
      0% { transform: translateX(0px); }
      100% { transform: translateX(0px); }
    }

    .anim {
      animation: mymove 1s linear infinite;
    }

    .paused {
      animation-play-state: paused;
    }
  </style>
</head>
<body>
<div id='mainanim'></div>
<hr>
<div id='cssanim' class='anim paused'></div>

<hr>
Press any key to toggle animation.

</body>
<script>

const targetMainFps =
  window.location.hash.length > 1 ? + window.location.hash.substr(1) : 0;
const skipEvery = targetMainFps > 0 ? parseInt(60 / targetMainFps) : 0;
const shouldJank = window.location.search.indexOf('?jank') >= 0;

const attributeName = 'transform';

var animating = false;
var frameCount = 0;

function animateStep() {
  if (skipEvery && ++frameCount % skipEvery == 0) {
    if (shouldJank) {
      const now = new Date();
      while ((new Date() - now) < 16) {}
    }
    mainanim.style[attributeName] = 'translateX(0px)';
  }
  if (animating)
    requestAnimationFrame(animateStep);
}

function startAnimation() {
  animating = true;
  requestAnimationFrame(animateStep);
  cssanim.classList.remove('paused');
}

function stopAnimation() {
  animating = false;
  cssanim.classList.add('paused');
}

function toggle() {
  if (animating) {
    stopAnimation();
  } else {
    startAnimation();
  }
}

window.onkeypress = toggle;
</script>
</html>