98 lines
2.9 KiB
HTML
98 lines
2.9 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<html lang="en">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<title>Test of -webkit-animation-play-state interacting with suspendAnimation</title>
|
|
<style type="text/css" media="screen">
|
|
#box1 {
|
|
height: 100px;
|
|
width: 100px;
|
|
background-color: blue;
|
|
margin: 0;
|
|
-webkit-animation-duration: 2s;
|
|
-webkit-animation-timing-function: linear;
|
|
-webkit-animation-name: "move1";
|
|
-webkit-animation-play-state: running;
|
|
}
|
|
@-webkit-keyframes "move1" {
|
|
from { -webkit-transform: translateX(0); }
|
|
to { -webkit-transform: translateX(400px); }
|
|
}
|
|
#box2 {
|
|
position:absolute;
|
|
top: 260px;
|
|
height: 100px;
|
|
width: 100px;
|
|
background-color: red;
|
|
-webkit-animation-duration: 2s;
|
|
-webkit-animation-timing-function: linear;
|
|
-webkit-animation-name: "move2";
|
|
}
|
|
@-webkit-keyframes "move2" {
|
|
from { left: 0; }
|
|
to { left: 400px; }
|
|
}
|
|
</style>
|
|
<script src="resources/animation-test-helpers.js" type="text/javascript" charset="utf-8"></script>
|
|
<script type="text/javascript" charset="utf-8">
|
|
|
|
const expectedValues = [
|
|
// [animation-name, time, element-id, property, expected-value, tolerance]
|
|
["move1", 0.55, "box1", "webkitTransform", [1,0,0,1,100,0], 20],
|
|
["move1", 0.65, "box1", "webkitTransform", [1,0,0,1,100,0], 20],
|
|
["move1", 0.75, "box1", "webkitTransform", [1,0,0,1,100,0], 20],
|
|
["move1", 1, "box1", "webkitTransform", [1,0,0,1,140,0], 20],
|
|
["move2", 0.55, "box2", "left", 100, 20],
|
|
["move2", 0.65, "box2", "left", 100, 20],
|
|
["move2", 0.75, "box2", "left", 100, 20],
|
|
["move2", 1, "box2", "left", 140, 20],
|
|
];
|
|
|
|
function pause()
|
|
{
|
|
document.getElementById("box1").style.webkitAnimationPlayState = "paused";
|
|
document.getElementById("box2").style.webkitAnimationPlayState = "paused";
|
|
}
|
|
|
|
function suspend()
|
|
{
|
|
if (window.internals)
|
|
internals.suspendAnimations();
|
|
}
|
|
|
|
function unpause()
|
|
{
|
|
document.getElementById("box1").style.webkitAnimationPlayState = "running";
|
|
document.getElementById("box2").style.webkitAnimationPlayState = "running";
|
|
}
|
|
|
|
function resume()
|
|
{
|
|
if (window.internals)
|
|
internals.resumeAnimations();
|
|
}
|
|
|
|
function setTimers()
|
|
{
|
|
setTimeout(pause, 500);
|
|
setTimeout(suspend, 600);
|
|
setTimeout(unpause, 700);
|
|
setTimeout(resume, 800);
|
|
}
|
|
|
|
runAnimationTest(expectedValues, setTimers, null /* event */, true /* disablePauseAnimationAPI */);
|
|
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<p>
|
|
This test makes sure a play-state change in an animation during suspend does not resume the animation.
|
|
<div id="box1">
|
|
</div>
|
|
<div id="box2">
|
|
</div>
|
|
<div id="result">
|
|
</div>
|
|
</body>
|
|
</html>
|