Understanding Simple Logo Drawing Commands - IECD Program Theory & Practical
Exploring the simple Logo drawing commands used in the Institute for Entrepreneurship and Career Development (IECD) program. Learn about moving the turtle, pen controls, setting pen size and color, hiding/showing the turtle, and more through practical examples and images.
Download Presentation
Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
E N D
Presentation Transcript
Institute for Entrepreneurship and Career Development (IECD) Logo Program Theory & Practicals K.Muthuramalingam Assistant Professor csbdu.in
The simple Logo drawing commands move the turtle forward and backward and turn it right or left. The commands and their abbreviations are given below: FD forward BK backward RT right turn LT left turn CS clear screen CT clear text PU Pen up PD pen down HT turtle disappears ST turtle appears
Sample movement of Turtle FD 50 RT 90 FD 50 RT 90 FD 50 RT 90 FD 50 RT 90
PU "pen up," it lifts the "pen" from the screen so that moving the turtle doesn't draw a line. Example: PU PD Puts the pen down so that moving the turtle draws a line. Example: PD SetPenSize [n n] Sets the width of the pen to n pixels. Note that it is necessary to put in two numbers. Example: SetPenSize [5 5] SETPC 5 FD 50 Setpensize [5 5] SETPC 8 FD 50 Pennormal Sets the pen back to normal mode
repeat 360[fd 1 rt 1] rt 90 fd 20 setfc [255 0 0] fill setfloodcolor [r g b] Sets the flood color to the appropriate RGB (Red, Green, Blue) values, where r, g, and b are numbers that range from 0 to 255. Example: setfloodcolor [255 0 255] (Gives magenta) fill Floods the area bounded by lines with whatever color was specified in the setfloodcolor command. Example: fill
HT/ST (HIDETURTLE/SHOWTURTLE) HT turtle disappears, but can still draw ST turtle appears on screen
setpos [x y] Sets the absolute x and position of the turtle. If the pen is down, it will draw a line from it's previous position. Example: setpos [100 90] Sets the turtle x=100 and y=90.
ARC a r Draw an arc with an included angle of a degrees and radius of r. However, the turtle remains at the center of the arc. Example: ARC 45 100 ARC2 a r Draw an arc with an included angle of a degrees and radius of r. However, the turtle ends up at the end of the arc. Example: ARC 45 100 Show XCOR , SHOW YCOR arc 45 100 arc 90 100 arc 180 100
Animation in Logo REPEAT 12 [REPEAT 4 [FD 100 RT 90] RT 30] REPEAT 6 [FD 100 REPEAT 6 [FD 10 BK 10 RT 60]BK 100 RT 60]
REPEAT 6 [FD 100 REPEAT 60 [FD 20 BK 20 RT 6]RT 60] REPEAT 8 [RT 45 REPEAT 6 [REPEAT 90 [FD 2 RT 2] RT 90]]
fd 50 bk 50 rt 90 fd 50 repeat 6 [fd 50 bk 50 rt 90 fd 50 lt 90]
PERSPECTIVE repeat 18 [ellipse 100 200 rightroll 10]
repeat 2 [ wait 20 rt 45 wait 20 fd 200 wait 20 rt 45 wait 20 fd 100 wait 20 rt 90] PERSPECTIVE REPEAT 18 [ELLIPSE 100 200 RIGHTROLL 10] PERSPECTIVE REPEAT 72 [ELLIPSE2 200 100 RIGHTROLL 5 FORWARD 5]
PERSPECTIVE REPEAT 18 [ELLIPSE 100 200 RIGHTROLL 10] PERSPECTIVE REPEAT 72 [ELLIPSE2 200 100 RIGHTROLL 5 FORWARD 5]
TO pentagon CS REPEAT 360 ~ [ PENERASE REPEAT 5 [FD 100 RT 72] RT 1 PENPAINT REPEAT 5 [FD 100 RT 72] WAIT 1 ] END
ARC Commands PERSPECTIVE REPEAT 36 [RIGHTROLL 10 ARC 90 100] PERSPECTIVE REPEAT 36 [RIGHTROLL 10 ARC2 180 100 ARC2 -180 100] CIRCLE Commands PERSPECTIVE REPEAT 36 [CIRCLE 100 RIGHTROLL 5] PERSPECTIVE REPEAT 72 [CIRCLE2 100 RIGHTROLL 5]