Animate the clip: rect property?

后端 未结 3 1635
栀梦
栀梦 2021-01-05 04:08

I want to animate the css property clip: rect with jQuery\'s .animate() but can\'t find if this is possible anywhere. Have tried:

$(

3条回答
  •  情深已故
    2021-01-05 04:13

    @Shivan Raptor

    To control duration, add duration: 3000, before the step attribute. So, the code would state:

    $('#A').on('click', function() {
    
        $(".img1").animate({
          fontSize: 1
        },
        {
          duration:3000,
          step: function(now, fx) {
              $(this).css('clip', 'rect(0px, '+(now+30)+'px, '+(now+30)+'px, 0px)')
          }
        }, 1000);
    
    
    });
    

    You have to play around with exactly how you want the animation to run, but this should help.

提交回复
热议问题