Advertisement
here2share

# turtle_makingwaves.py

Nov 9th, 2019
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. # turtle_makingwaves.py
  2.  
  3. from turtle import*
  4. from math import*
  5.  
  6. screen = Screen()
  7. speed(0)
  8.  
  9. def waveform(wlen, amp, iter, xcor, ycor, phase):
  10.     for i in range(400):
  11.         y= amp*sin(iter+phase)
  12.         x= wlen*iter/(2*pi)
  13.         goto(x+xcor,y+ycor)
  14.         iter+=0.1
  15.  
  16. setup(width = 500, height = 500, startx =200, starty =200)  
  17. bgcolor('lightblue')
  18. pensize(3)
  19. pencolor('blue')
  20.  
  21. up()
  22. xc=-300
  23. yc=-210
  24. goto(xc,yc)
  25. down()
  26.  
  27. for z in range(18):
  28.     waveform(100,10,0.1,xc,yc,pi/2)
  29.     up()
  30.     yc+=30
  31.     goto(xc,yc)
  32.     down()
  33.  
  34.     ht()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement