Through our last ecode Five-pointed Star project introduction, you must have some understandings on the ecode pen extension, today let’s do a more complicated drawing via the pen extension named Star Annulus, see the picture below:
Is it amazing? You can achieve it by making amendments on the basis of the code the five-pointed star.
Principle:
Please can think it by yourself and here is a tip by slowing the Gif and you may find the principle.
This figure is actually a combination of two movements, one is to draw a five-pointed star, the other is to turn a circle, first draw a five-pointed star, then turn it by an angle, then draw a five-pointed star, then turn it by another angle, and so on, one after the circle is turned, it becomes this beautiful figure. We have already learned how to draw a five-pointed star in the last project. Let’s turn an angle first, here we choose 15 degrees, and then execute it again, how many times do we need to turn it in total? One turn is 360 degrees, and one turn is 15 degrees, then 360/15=24, which means that you need to turn 24 times, and you just finish one turn, and then draw a five-pointed star for each turn until you finish one turn. Code:
1.Add another loop to the original that was executed 5 times, and execute it for 24 times
2.Add a sentence below the original loop that was executed 5 times, turn right 15 degrees, or turn left 15 degrees, and you’ve completed it!
Complete code:
If you have any ideas or opinions, please feel free to contact us via [email protected].