You are going to use LOGO to perform the basic transformations of translation, rotation, reflection and enlargement.
You will then apply what you have learnt to produce basic computer animations and image distortion effects.
1 Make a ShapeYou need to have a shape to experiment with. This code will produce a pentagonal star. repeat 5 [fd 200 rt 144] |
2 Make the same shape any size.It is more useful though to write this as a procedure called star which will draw a star of any size. Open the procedure editor by typing: edit "star Then type or cut and paste this code in. Then save it by clicking on save and exit in the file menu.
to star :size Test the code by typing: star 100 |
3 Translations.There are lots of ways to translate the image. One of the easiest is to use the setxy command.
cs star 100 |
4 Tidier TranslationsYou can get rid of the lines that join the stars by using the pu (pen up) and pd (pen down) commands. You can also use a repeat loop and the repcount command to automate the process. cs repeat 4 [pu setxy repcount*50 repcount*50 pd star 50] |
5 Simple Animation 1The easiest way to make an animation is to draw the image in blue, leave it for a moment, draw over it in white to erase it and then redraw the image somewhere else. This procedure will draw a moving star. Open the procedure editor by typing edit "anim
to anim Run the program with the command anim |
5 Simple Animation 2This procedure uses the random command to draw a star which jumps around in a 500px square box. Open the procedure editor by typing edit "anim2
to anim2 Run the program with the command anim2 |
EnlargementThis program enlarges star each time it is drawn. repeat 500 [cs star repcount] Enlargement and TranslationThis program enlarges and translates the star each time it is drawn. repeat 200 [cs pu setxy repcount repcount pd star repcount] Enlargement Rotation and TranslationThis program enlarges rotates and translates the star each time it is drawn. repeat 200 [cs pu setxy repcount repcount pd rt repcount*2 star repcount] |
Last modified 1st February 2012