+ 4

How to draw curves in svg?

Please give me example code, And explain the command.....

15th Jul 2017, 8:45 AM
Ankur Dutta Jha
Ankur Dutta Jha - avatar
7 Respostas
+ 5
using path.. example: <svg height="400" width="450"> <path d="M 100 350 q 150 -300 300 0" stroke="blue" stroke-width="5" fill="none" /> Explanation: 100 = left margin for curve start point (x) 350 = top margin for curve start point (y) q = quadratic Bézier curve (to draw curve) 150 = center point for the curve (curve ending point(x) / 2) -300 = curve direction ( <0 for up, >0 down, 0 = straight line) 300 = curve ending point (x) 0 = curve ending point (y) (always 0 for same point position(y) with curve start point ) I hope you understand what I mean. Forgive me can't explain more details, and correct me if im wrong
15th Jul 2017, 9:58 AM
Mugfirfauzy Siregar
Mugfirfauzy Siregar - avatar
+ 5
My linked code use also svg <path> element as good explained by @Mugfirfauzy Siregar, and animation is done by animating stroke style property (dashed border with dash/space size growing/reducing for simulating the realtime draw ;)
16th Jul 2017, 7:28 AM
visph
visph - avatar
+ 3
@Mugfirfauzy thanks for explanation. It is really good.
16th Jul 2017, 6:33 AM
Ankur Dutta Jha
Ankur Dutta Jha - avatar
+ 2
@visph can you explain it? Or, tell me other way....
16th Jul 2017, 6:34 AM
Ankur Dutta Jha
Ankur Dutta Jha - avatar
+ 2
Thanks to all (siregar and visph)
16th Jul 2017, 7:49 AM
Ankur Dutta Jha
Ankur Dutta Jha - avatar
+ 2
@Ankur Dutta Jha you're welcome..
16th Jul 2017, 9:04 AM
Mugfirfauzy Siregar
Mugfirfauzy Siregar - avatar