Draw with Vector Tools--Resource

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
AZSun
Posts: 30
Joined: Tue Mar 20, 2012 10:44 pm

Draw with Vector Tools--Resource

Post by AZSun » Sun Feb 02, 2014 5:59 pm

I've been working on learning the vector drawing tools and found a resource that helped. It is a HTML 5 website that has interactive graph paper. It lets you draw and then obtain the coordinate pairs. The cool part is that it appears to match the LiveCode setup with 0,0 in the top left of the screen.

http://www.garrettbartley.com/graphpaper.html

I know you can draw in LiveCode and then get the coordinates but I liked the graph paper part. I liked lining things up and being precise and easily bisecting polygons. I think the official drawing tutorials on graphing seem too business like for me. It may seem dumb, but they should show some creative product--like an apple. I hope this link was helpful.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Draw with Vector Tools--Resource

Post by Simon » Sun Feb 02, 2014 7:31 pm

Hi AZSun,
Bernd did a great grid for this;
http://livecodeshare.runrev.com/stack/757/GridDrawer

Adding the xy coordinates should be a simple task.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

AZSun
Posts: 30
Joined: Tue Mar 20, 2012 10:44 pm

Re: Draw with Vector Tools--Resource

Post by AZSun » Sun Feb 02, 2014 8:58 pm

Thanks Simon, very cool and now I can play inside LiveCode. And down the rabbit hole I go… I found the following thread http://forums.runrev.com/phpBB2/viewtop ... =9&t=13399 that has a lot of drawing shapes with code. I think I can learn a lot from "resize a rect" stack which has cool programatic drawing. I also found inside the User Samples button at the top of LC a stack called SVGL (Tigers, Awesome) that shows creative work.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: Draw with Vector Tools--Resource

Post by bn » Mon Feb 03, 2014 12:12 am

@Simon, thanks.

@AZSun

here I did what you are asking for (If I understand you correctly)
http://livecodeshare.runrev.com/stack/3 ... er-Utility
It is not to make the coordinates of a graphic but the coordinates of the markerPoints of a graphic. It is not really polished but should work. The markerpoints of a graphic show up at every point in a graphic if you choose to do that.
You can see an example here
http://livecodeshare.runrev.com/stack/749/Clock
change the "marker" etc.

You could adapt "MakeMarker-Utility" to drawing x,y coordinates instead of coordinates relative to the point of a graphic.

Also of note: If you set the points of a polygon graphic and then add a empty line and then add another set of points you will have two objects displayed in one graphic.

Code: Select all

131,206
164,142
177,207
132,206
131,206

122,248
184,277
122,299
126,252
122,248
put above into e.g. a field and make 1 graphic of style "freehand Polygon" then in the property inspector you paste these numbers into the "Points"

lots of fun playing around with graphics :)

Kind regards
Bernd

AZSun
Posts: 30
Joined: Tue Mar 20, 2012 10:44 pm

Re: Draw with Vector Tools--Resource

Post by AZSun » Mon Feb 03, 2014 4:05 am

Thanks Bernd,
here I did what you are asking for (If I understand you correctly)
Mostly I'm just playing and in the process trying to get my mind around the concept of drawing. So, I definitely appreciate your help with the examples where drawing is taking place. I will work more with the marker one to understand it better. I've read it a few times and need to repeat.

My thought was that there should be a spot where drawing info could be drawn together (sorry for the pun). Freehand Polygon did not show up in the dictionary so drawing with it seems a "you're on your own" kind of thing. The dictionary has polygon, but it talks about polygons being paint unless it is set to irregular and then it can be changed, but vector is not mentioned. Isn't it a vector shape? They have "Spray Can" in the dictionary!

Here's the tips so far:
--The blank line in the points list makes disconnected shapes. (Thanks for the two triangle example in this thread)
--The coordinate pairs don't have to be integers. They can be expressions that equal integers. Thus, you can use all sorts of math to make angles and drawings.
--The freehand polygon tool will make things that are not polygons. (Sorry if everyone already knew this. I was always closing the figure and you don't need to do that.) It will draw open figures and self-crossing figures.

I hope to have fun, thanks for all your help.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: Draw with Vector Tools--Resource

Post by bn » Mon Feb 03, 2014 10:23 am

Hi AZSun,

drawingTools.png
drawingTools.png (7.25 KiB) Viewed 4937 times
the drawing tools, and the ones within the red square are the ones where you can set the points. The rightmost in the rectangle is the one I meant, the tooltip says "Freehand Polygon". If you create on it is called graphic "Polygon"
I was always closing the figure and you don't need to do that.) It will draw open figures and self-crossing figures.
if you set the opaque of a polygon to true it will automatically close the figure. (click on it in the property inspector) That is what you want or not, depending on what you are doing. If you want to have a fill color for the polygon you have to set it to opaque.

Also when selecting a polygon look in the Object Menu, "Reshape Polygon". It lets you manually change the position of the points of a polygon by dragging them.

Kind regards
Bernd

Post Reply