clip - HTML CSS CSS Animatable Property

HTML CSS examples for CSS Animatable Property:clip

Introduction

In the following code the clip property of the following image is animating from its initial value "auto" to "rect(50px,250px,200px,0)", and back to the initial value "auto" again up to infinite times.

-webkit- prefix is for Chrome, Safari, Opera.

-moz- prefix is for Firefox.

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html lang="en">
 <head>
  <title>Example of CSS clip Property Animation</title>
  <style type="text/css">
img {<!--   w  ww .ja  va 2s .c o m-->
    position: absolute; /* Required for clipping */
    -webkit-animation: test 4s infinite; 
    animation: test 4s infinite;
}

@-webkit-keyframes test {
    50% {clip: rect(50px,250px,200px,0);}
}

@keyframes test {
    50% {clip: rect(50px,250px,200px,0);}
}
</style>
 </head>
 <body>
  <p> </p>
  <p><img src="https://www.java2s.com/style/demo/Opera.png" width="500" height="300" alt="Sky"></p>
 </body>
</html>

Related Tutorials