如何使用jQuery填充动画 [英] How to animate a fill with jQuery
本文介绍了如何使用jQuery填充动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用
element.css('fill','#000000');
它可以工作,但是现在我想为填充动画,所以我这样写:
and it works, but now I want to animate a fill so I wrote this:
$(element).animate({'fill': '#000000'}, 'slow');
但这不起作用,为什么?我要补充的是,我正在处理SVG文件.
but this doesn't work, why? I would add, I am working on SVG file.
推荐答案
将过渡指定为CSS的一部分可能比添加另一个js库更简单:
Specifying the transition as part of the CSS may be simpler than adding another js lib:
$('#circle').css({fill: "red", transition: "2.0s"});
这篇关于如何使用jQuery填充动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文