blob: b372acf33c6c5d88cab9d055a048c64e7f87cad2 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<style>
.box {
height: 100px;
width: 100px;
margin: 10px;
background-color: blue;
display: inline-block;
}
#rectangle-box {
-webkit-animation: rectangle-anim 2s linear
}
#circle-box {
-webkit-animation: circle-anim 2s linear
}
#ellipse-box {
-webkit-animation: ellipse-anim 2s linear
}
#polygon-box {
-webkit-animation: polygon-anim 2s linear
}
#none-box {
-webkit-animation: none-anim 2s linear
}
@-webkit-keyframes rectangle-anim {
from { -webkit-clip-path: rectangle(0%, 0%, 100%, 100%); }
to { -webkit-clip-path: rectangle(20%, 20%, 60%, 60%); }
}
@-webkit-keyframes circle-anim {
from { -webkit-clip-path: circle(50% at 50% 50%); }
to { -webkit-clip-path: circle(20% at 20% 20%); }
}
@-webkit-keyframes ellipse-anim {
from { -webkit-clip-path: ellipse(50%, 50%, 50%, 40%); }
to { -webkit-clip-path: ellipse(20%, 20%, 20%, 20%); }
}
@-webkit-keyframes polygon-anim {
from { -webkit-clip-path: polygon(nonzero, 0% 0%, 100% 0%, 100% 100%, 0% 100%); }
to { -webkit-clip-path: polygon(nonzero, 20% 20%, 80% 20%, 80% 80%, 20% 80%); }
}
@-webkit-keyframes none-anim {
/* We do not support animations from or to 'none' as specified. */
from { -webkit-clip-path: none; }
to { -webkit-clip-path: polygon(nonzero, 20% 20%, 80% 20%, 80% 80%, 20% 80%); }
}
</style>
<script src="../../animations/resources/animation-test-helpers.js"></script>
<script type="text/javascript">
const expectedValues = [
// [animation-name, time, element-id, property, expected-value, tolerance]
["rectangle-anim", 1, "rectangle-box", "webkitClipPath", "rectangle(10%, 10%, 80%, 80%, 0px, 0px)", 0.05],
["circle-anim", 1, "circle-box", "webkitClipPath", "circle(35% at 35% 35%)", 0.05],
["ellipse-anim", 1, "ellipse-box", "webkitClipPath", "ellipse(35%, 35%, 35%, 30%)", 0.05],
["polygon-anim", 1, "polygon-box", "webkitClipPath", "polygon(nonzero, 10% 10%, 90% 10%, 90% 90%, 10% 90%)", 0.05],
["none-anim", 1, "none-box", "webkitClipPath", "polygon(nonzero, 20% 20%, 80% 20%, 80% 80%, 20% 80%)", 0],
];
runAnimationTest(expectedValues);
</script>
</head>
<body>
<div class="box" id="rectangle-box"></div>
<div class="box" id="circle-box"></div>
<div class="box" id="ellipse-box"></div>
<div class="box" id="polygon-box"></div>
<div class="box" id="none-box"></div>
<div id="result">
</div>
</body>
</html>