def draw(): line(50, 100, 150, 100) circle(200, 100, 50) ellipse(300, 100, 50, 25) square(400, 100, 50) rect(500, 100, 50, 25) triangle(50, 200, 300, 250, 100, 300) quad(400, 200, 500, 250, 350, 300, 375, 100) arc(200, 400, 80, 80, 0, PI + QUARTER_PI, 'PIE')
#!/usr/bin/evn python # coding=utf-8 """ Shapes. """ import pyprocessing as p p.size(400, 500) # screen width and height # body p.triangle(100, 410, 200, 200, 300, 410) # 3 points (x,y) # hands p.ellipse(100, 300, 40, 40) # centre point (x,y) p.ellipse(300, 300, 40, 40) # and size (width,height) # face p.ellipse(200, 180, 190, 200) # mouth p.line(183, 246, 245, 230) # 2 points (x,y) # frames p.line(107, 163, 295, 163) # lenses p.rect(132, 150, 50, 40) # top left corner (x,y) p.rect(215, 150, 50, 40) # and size (width,height) p.run()
#!/usr/bin/evn python # coding=utf-8 """ Star. """ import math import pyprocessing as p p.size(400, 400) p.colorMode(p.HSB, 360, 100, 100, 100) p.noStroke() p.background(0) # TODO: try to change the alpha value p.fill(0, 100, 100, 40) # shift the (0, 0) point p.translate(200, 200) # TODO: try to change the number of triangles for i in range(10): # rotate around (0, 0) by 1/10th of a full angle p.rotate(2 * math.pi / 10) p.triangle(0, -200, 100, 100, -100, 100) p.run()