Explore
Courses
Batches
Sketches
Statistics
Code a Pookkalam
Jobs
Devsprint
People
Course Creation
Create a Course
Guidelines
Resources
Support
Blogs
My Profile
About Us
Login
Sketches
0
Sine Wave
By
Aditya Aravind
Run
from math import sin screen = rectangle(w=300, h=300, fill="black") def drawSine(x,y, color, width=100, cycles=2): global screen buffer = [] step = (3.14 * cycles ) / width height = width / (2 * cycles) for i in range(width): p = point(x+ i,y + height * sin(i * step)) buffer.append(p) screen += polyline(buffer, stroke=color , stroke_width=2) screen += line(-150, 0, 150, 0, stroke="green") drawSine(-150,0, 'red', 300, 3) show(screen)
Comments
Want to discuss?
Post it here, our mentors will help you out.
Login