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:FIDDLE
Since this is a popular question and was the top of Google search results when I looked for this today, here is a jQuery plugin that works with the
clip:
property and.animate()
natively.Credit: http://zduck.com/2013/jquery-css-clip-animation-plugin/
@Shivan Raptor
To control duration, add duration: 3000, before the step attribute. So, the code would state:
You have to play around with exactly how you want the animation to run, but this should help.