Making with Code

More Animation Lab #

In this lab we are going to continue to experiment with SuperTurtle and exploring decomposition and abstraciton.


[0] Set Up #

๐Ÿ’ป Go to your cs9/unit00_drawing folder.

cd ~/desktop/making_with_code/unit00_drawing/
๐Ÿ’ป Clone your repo. This will copy it onto your computer.
git clone https://github.com/the-isf-academy/lab_more_superturtle_yourGithubUsername

Below you’ll see that the git clone command has a yourGithubUsername.

You need to replace this with your username

e.g. https://github.com/the-isf-academy/lab_more_superturtle_emmaqbrown

๐Ÿ’ป In the Terminal, type the following command to open the lab folder.
cd lab_more_superturtle_yourGithubUsername

๐Ÿ’ป Enter the Poetry Shell to start the lab. We will run this command at the start of each lab, but only when we are inside a lab folder.

poetry shell

๐Ÿ’ป This lab uses a package called SuperTurtle. To use SuperTurtle in this repo, we must install it using poetry.

poetry install
๐Ÿ‘พ ๐Ÿ’ฌ Exiting the poetry shell

When you want to exit the shell, you can type exit or ^D

๐Ÿ’ป Take a look at the files inside with: ls

  • animation_tree.py
  • experiment.py
  • tree_parts.py
  • shapes.py

[1] Tree Animations #

This mini lab is designed to be a pick and choose adventure for practice animating with SuperTurtle.

๐Ÿ‘พ ๐Ÿ’ฌ Documentation

For lab, we recommend referencing the previous lab repository, lab_superturtle, and the offical documentation.

๐Ÿ“– SuperTurtle Documentation: superturtle.readthedocs.io/en/latest/animation.html

The offical documentation has a lot of information, so be sure to ask a teacher and experiment if you have any questions.


๐Ÿ’ป Let’s start by running animation_tree.py

python animation_tree.py

๐Ÿ’ป Take a look at the code with: code .

  • The main animation loop is in animation.py.
  • It uses the shapes.py file and tree_parts.py from the modules lab.

๐Ÿ’ป Fist, add a moon!

  • Look in shapes.py for a function you can use to draw the moon!
  • How will you move the moon across the screen?
    • Reference the previous lab OR the documentation

๐Ÿ’ป Now move the moon!

  • How can you use translate to move the moon across the screen?

๐Ÿ’ป Edit the settings.py file. Add the abilty to easily customize the moon size and color

  • How do you use variables from settings.py in animation_tree.py?
TOTAL_FRAMES = 240
TREE_TOP_COLOR = (40, 112, 58)
TREE_TRUNK_COLOR = (100,40,0)

๐Ÿ’ป Now, create a forest of trees!

  • You may keep the moon, or comment out the moon (command + ?)
  • You will need to use nested for loops and fly()

[2] Deliverables #

โšกโœจ For this lab, you should:

โ˜‘๏ธ At then end of class, be sure to fill out this Google form.

๐Ÿ’ป Push your code to Github

  1. git status
  2. git add file.py
  3. git status
  4. git commit -m "describe changes here"
  5. git push


[3] Experiment! #

๐Ÿ’ป In experiment.py, experiment by creating your own animation to create a new design using functions in shapes.py. We included the starter code from the documentation, but feel free to delete it and start fresh!

A few ideas…

  • a face with eyes that move
  • a car that moves across the screen
  • a llama with ears taht grow

๐Ÿ’ป Explore using the additional functions available to the animation transformations in SuperTurtle. Experiment with:

  • debug = True?
  • last_frame
  • cycles
  • restore_state_when_finished() in movement
  • dashes, dots, and rainbow in stroke
  • the available easing options