Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Animate CSS clip

Animate CSS clip

Problem

I am trying to use CSS3 transitions to animate a CSS clip with no sucess. The image just clips without the transition.

What am I missing?

#clipped {
    position:absolute;
    width: auto;
    clip: rect(100, 100, 100, 100);
    -webkit-transition: all 0.5s ease-out;
    -moz-transition: all 0.5s ease-out;
    transition: all 0.5s ease-out;
}
#clipped:hover {
    clip: rect(50px, 200px, 200px, 0);
}

Fiddle

Problem courtesy of: Rikard

Solution

Your code works just fine. You just have to give it the correct "start" values, like so:

img {
  position: absolute;
  display: block;
  clip: rect(10px, 100px, 200px, 0);
  -webkit-transition: all 0.5s ease-out;
     -moz-transition: all 0.5s ease-out;
          transition: all 0.5s ease-out;
}

img:hover {
  clip: rect(80px, 200px, 250px, 50px);
}
Solution courtesy of: Stefan Gruenwald

Discussion

View additional discussion.



This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here

Share the post

Animate CSS clip

×

Subscribe to Css3 Recipes - The Solution To All Your Style Problems

Get updates delivered right to your inbox!

Thank you for your subscription

×