简体   繁体   English

悬停时的SVG蒙版和动画

[英]SVG Mask and animation on hover

I'm not that good with SVG and mask and I would like to know if it's possible to have this animation on mouse hover? 我对SVG和蒙版的感觉不太好,我想知道是否可以在鼠标悬停时使用此动画? (with jquery or without) What I need: -Html text -SVG 3/4 circle -The background is the div background If it's not possible with html text, it would probably be possible with curve text in the svg... (使用jquery或不使用jquery)我需要什么:-HTML文本-SVG 3/4圆-背景是div背景如果html文本不可行,则svg中的曲线文本可能可行...

Here is an image of what I want to achieve: 这是我想要实现的图像:

我要实现的按钮

Couldn't find your font, didn't use math to be precise. 找不到您的字体,没有使用精确的数学运算。

 var wipe_steps = [ [1000, "0,0 500,0 500,500 0,500"], [100, "250,250 0,200 0,0 500,0 500,500 0,500 0,250"], [100, "250,250 0,100 0,0 500,0 500,500 0,500 0,250"], [100, "250,250 0,0 500,0 500,500 0,500 0,250"], [100, "250,250 100,0 500,0 500,500 0,500 0,250"], [100, "250,250 200,0 500,0 500,500 0,500 0,250"], [100, "250,250 250,0 500,0 500,500 0,500 0,250"], [100, "250,250 300,0 500,0 500,500 0,500 0,250"], [100, "250,250 400,0 500,0 500,500 0,500 0,250"], [100, "250,250 500,0 500,500 0,500 0,250"], [100, "250,250 500,100 500,500 0,500 0,250"], [100, "250,250 500,200 500,500 0,500 0,250"], [100, "250,250 500,250 500,500 0,500 0,250"], [100, "250,250 500,300 500,500 0,500 0,250"], [100, "250,250 500,400 500,500 0,500 0,250"], [100, "250,250 500,500 0,500 0,250"], [100, "250,250 400,500 0,500 0,250"], [100, "250,250 300,500 0,500 0,250"], [100, "250,250 250,500 0,500 0,250"], [100, "250,250 200,500 0,500 0,250"], [100, "250,250 100,500 0,500 0,250"], [100, "250,250 0,500 0,250"], [100, "250,250 0,400 0,250"], [100, "250,250 0,300 0,250"], [3000, ""] ]; var wipe_step = 0; function wipe() { wipe_step = wipe_step % wipe_steps.length; $('#wiper').attr('points', wipe_steps[wipe_step][1]); setTimeout(wipe, wipe_steps[wipe_step++][0]); } wipe(); 
 #animation { display: inline-block; width: 500px; height: 500px; } 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <div id="animation"> <svg viewBox="0 0 500 500" width="500" height="500"> <defs> <mask id="mising_quad" x="0" y="0" width="500" height="500" maskUnits="userSpaceOnUse"> <rect x="0" y="0" width="500" height="500" fill="white" /> <rect x="0" y="250" width="250" height="250" fill="black" /> </mask> <mask id="radial_wipe_mask" x="0" y="0" width="500" height="500" maskUnits="userSpaceOnUse"> <rect x="0" y="0" width="500" height="500" fill="white" /> <rect x="0" y="250" width="250" height="250" fill="black" /> <rect x="100" y="250" width="150" height="100" fill="white" /> <polygon id="wiper" points="" fill="black" /> </mask> </defs> <rect x="0" y="0" width="500" height="500" fill="rgb(230, 230, 230)" /> <circle cx="250" cy="250" r="200" fill="none" stroke="white" stroke-width="20" mask="url(#mising_quad)" /> <text x="100" y="210" fill="white" font-family="'Lucida Bright',Georgia,serif" font-size="45" font-weight="bold">MESSAGES <tspan x="100" y="270">AUX MEMBRES</tspan> <tspan x="100" y="330">SOCI&Eacute;TAIRES</tspan> </text> <circle cx="250" cy="250" r="200" fill="none" stroke="rgb(27, 125, 189)" stroke-width="20" mask="url(#radial_wipe_mask)" /> <text x="100" y="210" fill="rgb(27, 125, 189)" font-family="'Lucida Bright',Georgia,serif" font-size="45" font-weight="bold" mask="url(#radial_wipe_mask)">MESSAGES <tspan x="100" y="270">AUX MEMBRES</tspan> <tspan x="100" y="330">SOCI&Eacute;TAIRES</tspan> </text> Sorry, your browser does not support inline SVG. </svg> </div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM