Is there a good way to draw on the screen using commands? like control the brush or pencil with a move command, or create a series of of line segments with the create command?
Is there a sample somewhere?
Ron
Draw from commands
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 106
- Joined: Wed May 31, 2006 9:56 pm
- Location: College Station, Texas
- Contact:
-
- VIP Livecode Opensource Backer
- Posts: 9867
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
See the choose command and the drag command.
But if what you want are the resulting graphics, you can get much faster results with less code using the create command.
But if what you want are the resulting graphics, you can get much faster results with less code using the create command.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Posts: 106
- Joined: Wed May 31, 2006 9:56 pm
- Location: College Station, Texas
- Contact:
Drag works well
The drag works well- with some clever math it can be used to create the desired graphics.
I had tried creating graphics (Lines) and controlling their size and direction by setting the points. The math to calculate the points is about the same as the drag from-to math. I couldn't find a way to rotate them- seems like only images can be rotated, and then it is the content that rotates.
We are hoping to create a stack that lets the user create objects by specifying the sequence of draw, turn-right, draw, turn-left, etc. movements.
I had tried creating graphics (Lines) and controlling their size and direction by setting the points. The math to calculate the points is about the same as the drag from-to math. I couldn't find a way to rotate them- seems like only images can be rotated, and then it is the content that rotates.
We are hoping to create a stack that lets the user create objects by specifying the sequence of draw, turn-right, draw, turn-left, etc. movements.
Re: Drag works well
Oh cool. You're writing logo! Loved playing with that.
If you want the user to be able to do this step by step and see the results on screen I think you can do it by setting the points of a polygon.
First point is the start location. If they put in "move forward 10" calculate the 2nd point, add it to the list and set the points of your polygon to that list. The only things you'd need to track are your current orientation so you know which way is forward, and the current list of points. Any time a new "forward" command is entered, calculate the new point based on distance and angle tack the new point on to the end of the points list and set the poly to that list.
If you want the user to be able to do this step by step and see the results on screen I think you can do it by setting the points of a polygon.
First point is the start location. If they put in "move forward 10" calculate the 2nd point, add it to the list and set the points of your polygon to that list. The only things you'd need to track are your current orientation so you know which way is forward, and the current list of points. Any time a new "forward" command is entered, calculate the new point based on distance and angle tack the new point on to the end of the points list and set the poly to that list.
Ron Zellner wrote:The drag works well- with some clever math it can be used to create the desired graphics.
I had tried creating graphics (Lines) and controlling their size and direction by setting the points. The math to calculate the points is about the same as the drag from-to math. I couldn't find a way to rotate them- seems like only images can be rotated, and then it is the content that rotates.
We are hoping to create a stack that lets the user create objects by specifying the sequence of draw, turn-right, draw, turn-left, etc. movements.