Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Polygon Art! Make a polygon, rotate it!
- from random import *
- def getShape():
- vertexes = []
- for i in range(randint(3,5)):
- vertexes.append([randint(0,30)+20,randint(-30,30)])
- return vertexes
- def makeArt(x,y):
- #Shape 1, to go underneath
- s = getShape()
- noStroke()
- pushMatrix()
- translate(x,y)
- h = randint(0,255)
- a = randint(150,255)
- fill(h,255,200,a)
- stroke(h,255,255,a)
- strokeWeight(2)
- m = randint(6,10)
- for i in range(m):
- rotate(radians(360/m))
- beginShape()
- for j in range(len(s)):
- vertex(s[j][0],s[j][1])
- endShape(CLOSE)
- popMatrix()
- #Shape 2, put on top of shape 1
- s2 = getShape()
- pushMatrix()
- translate(x,y)
- h2 = randint(0,255)
- a2 = randint(150,255)
- fill(h2,255,200,a2)
- stroke(h2,255,255,a2)
- strokeWeight(2)
- m2 = randint(6,8)
- for i in range(m2):
- rotate(radians(360/m2))
- beginShape()
- for j in range(len(s2)):
- vertex(s2[j][0],s2[j][1])
- endShape(CLOSE)
- popMatrix()
- def setup():
- size(600,600)
- colorMode(HSB)
- def draw():
- background(50)
- for x in range(5):
- for y in range(5):
- makeArt((x*120)+60,(y*120)+60)
- noLoop()
Add Comment
Please, Sign In to add comment