使用jQuery创建文本阴影的元素 [英] Animating elements of text-shadow with jQuery
问题描述
我想知道是否有任何方法,使用jQuery,动画效果的文本阴影的大小或颜色的属性。
I was wondering if there was any way to, using jQuery, animate properties of text-shadow like size or colour.
这是令人讨厌的, text-shadow-color
的属性,而不是只能以组合形式提供的语句。
It's annoying that there aren't individual properties like text-shadow-color
instead of the statement only being available in combined form.
推荐答案
这个答案可能晚了一点,但是在这里它总是...
Might be a little late for this answer, but here it is anyway...
我通过实现一个虚拟css属性以像这样的动画。
I solved it by implementing a "virtual" css-property to be animated like this
$.fx.step.textShadowBlur = function(fx) {
$(fx.elem).css({textShadow: '0 0 ' + Math.floor(fx.now) + 'px black'});
};
$(el).css({textShadowBlur:20})
.animate({textShadowBlur:1}, {duration: 1000});
这里有更详细的描述:
http://usefulthink.com/2010-12/animating-text-shadow-using-jquery
This is described in more detail here: http://usefulthink.com/2010-12/animating-text-shadow-using-jquery
其他一些方法可以在这里找到:
http://forum.jquery.com/topic/let-s-animate-text-shadow
Some other approaches can be found here: http://forum.jquery.com/topic/let-s-animate-text-shadow
这篇关于使用jQuery创建文本阴影的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!