Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE html>
<html id="top">
<meta charset="utf-8">
<title>View timeline delay</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/web-animations/testcommon.js"></script>
<script src="/scroll-animations/scroll-timelines/testcommon.js"></script>
<script src="/scroll-animations/view-timelines/testcommon.js"></script>
<style>
#container {
overflow-x: scroll;
height: 200px;
width: 200px;
}
#content {
translate: 50px;
width: 1800px;
margin: 0;
}
.spacer {
width: 800px;
display: inline-block;
}
#target {
background-color: green;
height: 100px;
width: 100px;
display: inline-block;
font-size: 10px;
}
</style>
<body>
<div id="container">
<div id="content">
<div class="spacer"></div>
<div id="target"></div>
<div class="spacer"></div>
</div>
</div>
</body>
<script type="text/javascript">
promise_test(async t => {
const timeline = new ViewTimeline({
subject: target,
axis: "inline"
});
const anim = target.animate({ backgroundColor: ['green', 'red' ] },
{ timeline: timeline });
await new Promise(requestAnimationFrame);
assert_px_equals(timeline.startOffset, 654, 'startOffset');
assert_px_equals(timeline.endOffset, 954, 'endOffset');
});
</script>