| animation-name: animation; |
| animation: animation 0.2s infinite; |
| animation-duration: 0.2s; |
| animation-iteration-count: infinite; |
| to { margin-left: "100px" }; |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| const once = { once: true }; |
| const target = document.getElementById("target"); |
| target.classList.add("animated"); |
| target.addEventListener("animationstart", event => { |
| // Now we can cancel this animation. |
| target.classList.remove("animated"); |
| target.addEventListener("animationend", event => { |
| // We wait a frame, resume the animation and check it's the same animation. |
| requestAnimationFrame(() => { |
| target.classList.add("animated"); |
| target.addEventListener("animationstart", event => t.done(), once); |
| }, "A CSS Animation can be canceled and resumed by modifying its animation-duration."); |