parse-animation-timing-function-steps.html 759 B

123456789101112131415161718192021222324252627
  1. <!DOCTYPE html>
  2. <style>
  3. @keyframes test-animation {
  4. from {
  5. transform: translateX(0);
  6. }
  7. to {
  8. transform: translateX(100px);
  9. }
  10. }
  11. .animate {
  12. animation: test-animation 2s steps(1, jump-none) infinite;
  13. }
  14. </style>
  15. <div class="box animate" style="width: 50px; height: 50px; background-color: red;"></div>
  16. <script src="../../include.js"></script>
  17. <script>
  18. test(() => {
  19. // Apply animation dynamically to trigger re-computation.
  20. document.querySelector('.box').classList.add('animate');
  21. // Log computed style to confirm the animation is parsed and applied correctly.
  22. const animation = getComputedStyle(document.querySelector('.box')).animationTimingFunction;
  23. println('Computed animation-timing-function: ' + animation);
  24. });
  25. </script>