<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS clip 属性动画示例- 基础教程(div.cn)</title>
<style>
img {
position: absolute; /* Required for clipping */
-webkit-animation: test 4s infinite; /* Chrome, Safari, Opera */
animation: test 4s infinite;
}
/* Chrome, Safari, Opera */
@-webkit-keyframes test {
50% {clip: rect(50px,250px,200px,0);}
}
/* Standard syntax */
@keyframes test {
50% {clip: rect(50px,250px,200px,0);}
}
</style>
</head>
<body>
<p> <strong>警告:</strong>:CSS动画在Internet Explorer 9和更早版本中不起作用。 clip属性不能像其他可设置动画的属性那样平滑地动画。</p>
<p> <strong>注意</strong>:下图的clip属性正在从其初始值“ auto”动画化为“ rect(50px,250px,200px,0)”,然后又恢复为初始值“ auto ”,直到无限次。</p>
<p><img src="/run/images/sky.jpg" width="500" height="300" alt="Sky"></p>
</body>
</html>