How do I animate a glowing effect on text?

前端 未结 6 1076
闹比i
闹比i 2021-01-31 10:48

I haven\'t really been able to find any good simple tutorials an animating a glow effect. How do I animate glowing on text?

6条回答
  •  无人共我
    2021-01-31 11:06

    Here is an animation effect that I have found useful in the past by adding a new step function to the jQuery fx object.

    $.fx.step.myBlurRedEffect = function (fx) {
        $(fx.elem).css({
            textShadow: '0 0 ' + Math.floor(fx.now) + 'px #FF0000'
        });
    }
    

    Which is called in the usual way (say blur 6px in half a second):

    $('#myID').animate({
        myBlurRedEffect: 6
    },{
        duration: 500
    });
    

    http://jsfiddle.net/whLMZ/1/

    This should get you started, and you should find many fun ways to extend upon this, add other CSS parameters etc... :)

提交回复
热议问题