svg.js

How can i use timelines in version svg.js 3.x

浪子不回头ぞ 提交于 2019-12-24 01:28:26
问题 There seems to be a new timeline-feature in svg.js Version 3.x. I'd like to try this feature but I don't understand the api. As far as I see, the documentation has not been updated yet. Could you please give me an example that shows me how to get started with timelines? Thanks Michael 回答1: A new timeline is created for every element automatically when you animate it or request it: const animationRunner = el.animate(duration).move(100, 100) // cretates a timeline const timeline = el.timeline()

SVG shapes with fill, stroke and strokewidth

孤人 提交于 2019-12-14 04:23:35
问题 I have a polygon shape with border, stroke-width and fill colors. I am looking for multiple polygon shapes; below is one of them with 4 edges. Out of which 3 edges just have stroke and the other edge has fill color. From above figure we have one side of the polygon with fill and stroke, others just stroke with strokeWidth 1. I am quite new to SVG. What can be the best way to draw this shape? Paths, lines, polygons, or combination of this? Will fill-rules be helpful here? Suggestions please.

Invert mask with svg.js

老子叫甜甜 提交于 2019-12-11 02:57:51
问题 I'm starting to use svg.js on a project, and as I was playing with masks, I couldn't manage to invert them. I drew a rectangle, and a circle, using the circle as a mask for the rectangle, only showing the part of the rectangle that's inside the mask. var leftRect = draw.rect(300, 200); var maskTest = draw.circle(100); leftRect.attr({ x: 100, y: 100, fill: '#FF64F9' }); maskTest.transform({ x: 150, y: 150 }); leftRect.clipWith(maskTest); Now I want the opposite, I want to mask to display

Find center of svg shape

送分小仙女□ 提交于 2019-12-10 17:46:21
问题 Im using svgjs to create my shapes. How can I find the center point of an svg shape and add an element there? In my case a red dot. I can't find any information in the documentation for a method or something that helps in this situation. 回答1: You can use the method getBBox or alternatively getBoundingClientRect. Both methods give you an object with the properties x, y, width, height , which you can use to calculate your center. Since you tagged your question with svg.js I will also give you a

Mask rotated SVG element

放肆的年华 提交于 2019-12-07 08:23:51
问题 I am using svg.js to draw my SVG. I was wondering, whether it's possible to mask rotated element. I could achieve rotating masked element, which isn't the same. See a minimal working example - http://jsfiddle.net/mreq/LP7sa/1/ - I'd like the rotated image to be masked with the red rectangle. The example produces following code: <svg xmlns="http://www.w3.org/2000/svg" id="SvgjsSvg1000" version="1.1" width="100%" height="100%" xlink="http://www.w3.org/1999/xlink" style="position:relative

Mask rotated SVG element

谁都会走 提交于 2019-12-05 18:02:54
I am using svg.js to draw my SVG. I was wondering, whether it's possible to mask rotated element. I could achieve rotating masked element, which isn't the same. See a minimal working example - http://jsfiddle.net/mreq/LP7sa/1/ - I'd like the rotated image to be masked with the red rectangle. The example produces following code: <svg xmlns="http://www.w3.org/2000/svg" id="SvgjsSvg1000" version="1.1" width="100%" height="100%" xlink="http://www.w3.org/1999/xlink" style="position:relative;overflow:hidden;left:0px;top:0px;"> <rect id="SvgjsRect1003" width="50%" height="50%" y="75" x="125" fill=

Create svg arcs between two points

江枫思渺然 提交于 2019-12-04 08:56:10
问题 I want to connect two SVG points (e.g. the centers of two circles) using arcs. If there is only one connection, the line ( <path> ) will be straight. If there are two connections, both will be rounded and will be symmetrical, this way: So, in fact, there are few rules: Everything should be symmetrical to to the imaginary line that connects the two points. From 1, it's obvious that if the number of connections is: odd: we do not display the straight line even: we display the straight line

nested svg ignores transformation in Chrome and Opera [duplicate]

纵然是瞬间 提交于 2019-12-02 22:31:22
问题 This question already has answers here : SVG translate seems to behave different in Chrome/Chromium (2 answers) Closed 4 years ago . I experienced somewhat that I would call a bug. I have the following 2 svg: <svg height="100%" width="100%" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" xmlns="http://www.w3.org/2000/svg" id="SvgjsSvg1004"> <defs id="SvgjsDefs1005"></defs> <g transform="matrix(2,0,0,2,50,50)" id="SvgjsG1011"> <rect height="50" width="50" id="SvgjsRect1012"></rect> <

nested svg ignores transformation in Chrome and Opera [duplicate]

断了今生、忘了曾经 提交于 2019-12-02 07:35:18
This question already has an answer here: SVG translate seems to behave different in Chrome/Chromium 2 answers I experienced somewhat that I would call a bug. I have the following 2 svg: <svg height="100%" width="100%" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" xmlns="http://www.w3.org/2000/svg" id="SvgjsSvg1004"> <defs id="SvgjsDefs1005"></defs> <g transform="matrix(2,0,0,2,50,50)" id="SvgjsG1011"> <rect height="50" width="50" id="SvgjsRect1012"></rect> </g> </svg> <svg height="100%" width="100%" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" xmlns="http://www.w3.org