Camp Explore
ArtLogo
ArtLogo
During day two we will use ArtLogo to further our programming explorations and experience. ArtLogo, like TurtleArt, is based on the Logo programming language. ArtLogo uses text rather than blocks to program designs. There are a few additional features in ArtLogo that are worth exploring as well.
Open your web browser and load ArtLogo. The window is more spare than the TurtleArt one we used yesterday.
Let's start by playing with the same square procedure that you programmed yesterday in TurtleArt. Type the following in the pane at the left of the ArtLogo window:
to square
repeat 4 [
fd 150
rt 90 ]
end
Make sure you type it exactly as shown, and notice what kind of brackets are used.
You can then type square in the Command Center pane of ArtLogo. Press the return key on your keyboard to have the turtle run the procedure.
Go back to the procedure area where you typed the square procedure. Underneath, type a new procedure:
to go
clean
repeat 10 [
square
rt 360 / 10 ]
end
Again, make sure you check the syntax of your commands and the brackets. You can then type go in the Command Center.
The ArtLogo Reference page has the sytax for all the turtle's commands..
Make sure you open the ArtLogo Reference in another tab: it has a list of all the commands that the turtle knows.
In order to save the designs you program in ArtLogo you have to explicitly save the file. The downloaded file is in png format and contains the image as well as the text procedures that you write.
In the Command Center type the following command in order to save your work:
saveimage "imageNameHere
If you drag and drop that file into a new window with ArtLogo loaded the procedures and image will return. You will need to save the file again if you make any changes.
Art Samples, including the TurtleArt cards programmed in ArtLogo (downloads a zip file that decompresses into a directory with the files)
There are two features in ArtLogo that are not present in TurtleArt that can add a depth of complexity to the images you program.
You can create an opacity to the fill your turtle uses in closed polygons or other shapes. Here is an example.
to squareFillOpacity
clean
setxy -350 25
setpensize 20
setc 15
rt 90
fd 700
setxy -335 -50
lt 90
setpensize 4
setc 0
storeinbox1 75
repeat 4 [
setopacity box1
startfill
square
endfill
storeinbox1 box1 - 25
setxy xcor + 175 ycor
end
to square
repeat 4 [
fd 150
rt 90 ]
end
ArtLogo contains two commands, snapimage and drawsnap, that allow you to create basic animation with a collection of designs that you program the turtle to draw. After the turtle draws a design it stores a "snap" of the image using the snapimage command. You can then write another procedure to play back these snaps using the drawsnap command.
Here are sample procedures that uses two variables, storeinbox1 and storeinbox2. The first variable, box1, stores the opacity of the fill. The second variable, box2, stores the snap that you are taking. The go procedure needs to be run first as it creates the snaps. The replay procedure plays back the snaps.
to go
clean
ht
setxy -100 -100
storeinbox1 0
storeinbox2 1
repeat 10 [
setopacity box1
startfill
repeat 4 [fd 200 rt 90]
endfill
snapimage box2
storeinbox1 box1 + 10
storeinbox2 box2 + 1
wait 5]
end
to replay
clean
ht
loop [
storeinbox2 1
repeat 10 [
drawsnap box2
wait 5
storeinbox2 box2 + 1] ]
end
Work on programming original designs. Make sure you save and download your designs: you will need them for the last day of the workshop!