Svg - javascript | Sololearn: Learn to code for FREE!


Svg - javascript

how can I creat a SVG with the coordinates of 2 other SVG which the user can move ? example : the user move SVG-1<rect> to: x=0 y=0 (width=50 height=50) and move the SVG-2 <rect> to: x=10 y=50 (width=50 height=50) and then creat a third SVG-3 (unvisible) with coordinates: x1=0 (x of SVG-1) y1=0 (y of SVG-1) x2=60 (x+50 of SVG-2) y2=100 (y+50 of SVG-2) and of course when the user move of the 2 SVG <rect> the coordinates of SVG-3 will actualise (sorry for my bad english...) thanks

9/30/2017 4:00:43 PM


11 Answers

New Answer


I've already creat the twice svg draggable but idk how to creat the third


@Andrew G


but my code need animation and in sololearn it doesn't work, so I don't have this code on SL... I will creat a code just with this 2 elements


I havent could. Im interesting because in other way I think we must to use canvas


you have Xa and Ya the left up corner of bloc-1. You have Xb and Yb the right down corner of bloc-2. I want a new <rect> with the coordinates Xa,Ya;Xb,Yb.


with a draw I can shiw you easily, have you discord ?