+ 4
How to draw curves in svg?
Please give me example code, And explain the command.....
7 Respuestas
+ 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
+ 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 ;)
+ 3
@Mugfirfauzy thanks for explanation.
It is really good.
+ 2
@visph can you explain it?
Or, tell me other way....
+ 2
Thanks to all (siregar and visph)
+ 2
@Ankur Dutta Jha you're welcome..