mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:27:35 +00:00
29 lines
1.3 KiB
HTML
29 lines
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<div id="foo"></div>
|
|
<script src="../../include.js"></script>
|
|
<script>
|
|
asyncTest(done => {
|
|
const foo = document.getElementById("foo");
|
|
|
|
let animation = new Animation(null, null);
|
|
println(`Animation with no timeline has null currentTime: ${animation.currentTime === null}`);
|
|
|
|
animation = new Animation(new KeyframeEffect(foo, []));
|
|
println(`Animation that hasn't been played has null currentTime: ${animation.currentTime === null}`);
|
|
|
|
animation = foo.animate({ color: "red" }, { duration: 1000 });
|
|
println(`Played animation has a currentTime of 0: ${animation.currentTime === 0}`);
|
|
|
|
setTimeout(() => {
|
|
// FIXME: Figure out how to consistently test timings
|
|
// if (animation.currentTime > 95 && animation.currentTime < 105)
|
|
// println("Animation time after 100ms is correct");
|
|
|
|
animation = foo.animate({ opacity: [0, 1] }, { duration: 1000 });
|
|
println(`New animation has not started animating: ${getComputedStyle(foo).opacity === "0"}`);
|
|
animation.currentTime = 1000;
|
|
println(`Animation with currentTime set to end is finished: ${getComputedStyle(foo).opacity === "1"}`);
|
|
done();
|
|
}, 100);
|
|
});
|
|
</script>
|