开发者

Simple SVG drawing for HTML-JavaScript animation

开发者 https://www.devze.com 2023-03-13 14:50 出处:网络
I\'m trying to dra开发者_如何学Pythonw a simple battery symbol in SVG which will be animated using HTML/JavaScript:

I'm trying to dra开发者_如何学Pythonw a simple battery symbol in SVG which will be animated using HTML/JavaScript:

http://pastebin.com/utM4BTRS

I'd like to dynamically manipulate the mask over the "battery level" drawing inside the SVG but the mask is not displayed as drawn in Inkscape. Firefox and Webkit both display only a tiny bit of that part (no JavaScript involved yet):

http://tinypic.com/view.php?pic=deu44m&s=7 (Inkscape drawing on the left, Firefox rendering on the right)

Since I am new to SVG: what's the problem here?


Unless you need to use e.g gradients in the mask you should try to use clip-path instead. Actually, if you can remove the use of mask completely that's even better.

Now, to answer your question, you can remove maskUnits="userSpaceOnUse" from the mask element and it will work. Also you should save as "Plain SVG" from inkscape when exporting, it makes the svg output look a tad cleaner.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号