project_drawing/drawing.py

62 lines
1.1 KiB
Python

# drawing.py
# ----------
# By Hope Wright
#
# a turtle and bubbles will be drawn and animate swimming across the screen
# phase 2 would be to have it start smaller and grow is it swims across the screen to look like it's getting closer
# phase 3 would be to animate the bubbles.
from turtle import *
from superturtle.movement import fly
from superturtle.animation import animate
import math
def draw_turtle(size):
#draw an oval for the shell
height = size*2
width = size*1.5
steps = 100
for i in range(steps + 1):
angle = 2 * math.pi * i / steps
x = (width) * math.cos(angle)
y = (height) * math.sin(angle)
goto(x,y)
#move to top of for head
penup()
left(90)
forward(size*4)
left(90)
forward(size*1.5)
pendown()
#draw a circle for the head
circle(size)
#draw some lines on the shell
penup()
left(90)
forward(size*2)
pendown()
forward(size*4)
right(180)
forward(size*2)
left(90)
forward(size*1.5)
penup()
left(180)
forward(size*1.5)
pendown()
draw_turtle(20)
done()