38 lines
805 B
HTML
38 lines
805 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<style>
|
|
|
|
#target {
|
|
position: absolute;
|
|
left: 0;
|
|
top: 0;
|
|
width: 100px;
|
|
height: 100px;
|
|
background-color: black;
|
|
will-change: transform;
|
|
}
|
|
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="target"></div>
|
|
<script>
|
|
|
|
if (window.testRunner)
|
|
testRunner.waitUntilDone();
|
|
|
|
const animation = document.getElementById("target").animate({ transform: ["translateX(50px)", "translateX(100px)"] }, 1000);
|
|
|
|
// Wait until the animation is ready which means the action to play an accelerated animation has been enqueued by now, but not commmitted.
|
|
animation.ready.then(() => {
|
|
// Cancel the animation, this should cancel the uncommitted accelerated animation.
|
|
animation.cancel();
|
|
if (window.testRunner)
|
|
testRunner.notifyDone();
|
|
});
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|