I want to animate the css property clip: rect
with jQuery's .animate()
but can't find if this is possible anywhere. Have tried:
$(".img1").animate({
clip: "rect(1px, 945px, 499px, 1px)"
},300);
without any luck. Does anyone know?
Thanks
Anything is possible, but there probably are easier ways to do what you want without using clip
, but if you use jQuery animate's fx.step function, you can animate anything, but you need to do some calculations to figure out values and stuff, but it goes something like this:
$(".img1").animate({
fontSize: 100 //some unimportant CSS to animate so we get some values
},
{
step: function(now, fx) { //now is the animated value from initial css value
$(this).css('clip', 'rect(0px, '+now+'px, '+now+'px, 0px)')
}
}, 10000);
FIDDLE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With