(Beginner-Friendly) Easy Rainbow Tubes Animation!

by nigirizushi in Craft > Digital Graphics

104 Views, 0 Favorites, 0 Comments

(Beginner-Friendly) Easy Rainbow Tubes Animation!

Screen Shot 2023-04-07 at 12.56.44 PM.png

Welcome! Today I will show you how to make a Rainbow Tubes Animation, completely beginner friendly. This is a beautiful project to start off with for a coding journey.

Supplies

Screen Shot 2023-04-07 at 12.31.28 PM.png

-Computers work best, so you can type the code with them.

-CodeHS, or any other coding website that supports Python Turtle

Starting Our Project

Screen Shot 2023-04-07 at 12.31.28 PM.png
Screen Shot 2023-04-07 at 12.32.14 PM.png

To begin our project, you will need an account preferably on CodeHS. However, if you know another website that supports Python Turtle, then feel free to use it as well. CodeHS is free, and you can use this link to visit its homepage: codehs.com

Once finished, you can scroll through the coding languages and click on Python Turtle. Please make sure not to confuse this with similar languages like Pygame or Python, as they won't work.

Use a Default Template and start from scratch. If there is already code on the Default Template, then you can clear it.

Making the Rainbow Tubes Animation

Screen Shot 2023-04-07 at 12.55.36 PM.png

If using the pictures, you can copy the code. You do not need to copy what is written in green with the hashtag # symbol. That is to help you understand and try the animation. You also do not need to copy the bullet points with the hashtag # symbol if you are following the steps here. Only copy the line numbers. Here is the code and steps:

1. speed(0)

  • #First set your speed, or keep it at 0.

2. colors = ['red', 'orange', 'yellow', 'green', 'blue', 'purple'] 

  • #In apostrophes, set the colors you want for your animation. Try to use less complicated colors. Colors like Xanadu (type of green) may be reduced to a normal shade of green.

3. for i in xrange(180):

4. set_color(colors[i % len(colors)])

5. forward(i)

6.  circle(60)

7. penup()

8. left(60)

9.  pendown()

  • #Try to keep up with the indenting here. If you don't click 'tab' on your keyboard for steps 4-9, you may face an error.
  • #This is the code for the turtle to go in different directions to create your animation
  • #The numbers in parenthesis are how many times the turtle will go in these directions
  • #Try expirementing with different codes here as well! e.x. "right(60)"

Congratulations! Now if you click "Run" under "Output" then you'll have a Rainbow Tubes animation!

Make sure to thoroughly check for any spelling mistakes or wrong indentation that may hinder the end result.

End!

Screen Shot 2023-04-07 at 12.56.44 PM.png

Thank you for following along! Above I put the picture of my final result. Do you think you can make variations to this project as well (examples: changing the colors, numbers, or even adding inputs for the user)?