line and polyline: where are the coordinates? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

line and polyline: where are the coordinates?

Is there anyway to predetermine where the coordinates are located while coding an SVG line or polyline? Or do you just have to use trial and error until the line is approximately where you want it?

26th Nov 2018, 3:43 AM
Sergio Di Martino
Sergio Di Martino - avatar
3 Answers
+ 3
I'm not completely sure what you mean. Say, I want to draw a rectangle using just lines. I can specify the coordinates as something like (0, 0), (0, 100), (100, 50), (0, 50) Then, after seeing the result, maybe I want to make my rectangle bigger and change it to (0, 0), (0, 300), (300, 150), (0, 150) Is that the type of adjustments you are talking about? Then yes, we might have to do them. Though I imagine with more practice we can develop an intuition about that too. I also invite my favourite webgl artist on Sololearn, Paul, if he can share some wisdom 😊
28th Nov 2018, 10:18 AM
Kishalaya Saha
Kishalaya Saha - avatar
+ 5
The top left corner of the svg image has coordinate (0, 0). The x coordinate increases as we go right, and the y coordinate increases as we go down. The unit is in pixels. Does that help? Please let us know. Thanks! 😊
26th Nov 2018, 4:42 AM
Kishalaya Saha
Kishalaya Saha - avatar
+ 1
What I meant was, is there anyway to know where a point will be located, or do you just have to make your best guess and then adjust as necessary after looking at the results in a browser? There's no easy way to word my question. I hope you understand.
28th Nov 2018, 9:45 AM
Sergio Di Martino
Sergio Di Martino - avatar