svg实现不规则渐变流线

重点: 流线是圆的一条半径, 圆的颜色为径向渐变,  此渐变圆是svg的path的遮罩

<!DOCTYPE html>

<html>

<body style="margin-top: -300px">

    <svg className='dv-svg-container' width=1086 height="838">

        <defs>

            <path id="path" 

                d="M 17 541.89C 17 541.89 -1 620.89 7 644.89C 33 646.89 155 672.89 189 711.89C 200 746.89 155 804.89 415 823.89C 544 827.89 1053 626.89 1053 626.89"

                fill='transparent' />



            <radialGradient id="grad1" cx="50%" cy="50%" r="50%" fx="50%" fy="50%">

                <stop offset="0%" style="stop-color:red;stop-opacity:1" />

                <stop offset="20%" style="stop-color:red;stop-opacity:.9" />

                <stop offset="100%" style="stop-color:red;stop-opacity:0" />

            </radialGradient>



            <mask id="mask">

                <circle id="circle" cx='0' cy='0' r='120' fill='url(#grad1)'>

                    <animateMotion dur='4'

                        path="M 17 541.89C 17 541.89 -1 620.89 7 644.89C 33 646.89 155 672.89 189 711.89C 200 746.89 155 804.89 415 823.89C 544 827.89 1053 626.89 1053 626.89"

                        rotate='auto' repeatCount='indefinite' />

                </circle>

            </mask>

        </defs>

        <use href='#path' stroke="rgba(0, 0, 0, .1)" strokeWidth='1'>

        </use>

          <use href='#path' stroke="red" mask='url(#mask)' stroke-width="4">

            <animate attributeName='stroke-dasharray' from='0, 1250' to='1250, 0' dur='4s' repeatCount='indefinite' />

        </use>

 </svg>

</body>

</html>

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值