kopia lustrzana https://github.com/villares/sketch-a-day
main
rodzic
4bd7216756
commit
5f3650a91c
|
@ -1,28 +1,21 @@
|
|||
# Alexandre B A Villares - https://abav.lugaralgum.com/sketch-a-day
|
||||
from __future__ import division
|
||||
# Revisitig ideas from sketch 71 180312
|
||||
|
||||
SKETCH_NAME = "s138" # 1805168
|
||||
|
||||
"""
|
||||
Revisitig sketch 71 180312
|
||||
"""
|
||||
|
||||
|
||||
|
||||
def setup():
|
||||
size(600, 600)
|
||||
noFill()
|
||||
|
||||
def draw():
|
||||
poly_shape(width / 2, height / 2, PI/3, 3, 2, PI/2)
|
||||
poly_shape(width / 2, height / 2, PI/3, 4)
|
||||
|
||||
def poly_shape(x, y, angle, D, sat, rotation):
|
||||
K = 5 # randomness added to vertex positions
|
||||
stroke(frameCount % 256) #black to white, jump to black
|
||||
def poly_shape(x, y, angle, D):
|
||||
rv = 3 # randomness added to vertex positions
|
||||
stroke(255 - frameCount % 256) #white to black, jump to white
|
||||
with pushMatrix():
|
||||
translate(x, y)
|
||||
rotate(rotation)
|
||||
radius = D * 40
|
||||
radius = D * 27
|
||||
# create a polygon on a ps PShape object
|
||||
ps = createShape()
|
||||
ps.beginShape()
|
||||
|
@ -30,7 +23,7 @@ def poly_shape(x, y, angle, D, sat, rotation):
|
|||
while a < TWO_PI:
|
||||
sx = cos(a) * radius
|
||||
sy = sin(a) * radius
|
||||
ps.vertex(sx + random(-K, K), sy + random(-K, K))
|
||||
ps.vertex(sx + random(-rv, rv), sy + random(-rv, rv))
|
||||
a += angle
|
||||
ps.endShape(CLOSE) # end of PShape creation
|
||||
shape(ps, 0, 0) # Draw the PShape
|
||||
|
@ -39,5 +32,5 @@ def poly_shape(x, y, angle, D, sat, rotation):
|
|||
# for each vertex
|
||||
pv = ps.getVertex(i) # gets vertex as a PVector
|
||||
# recusively call poly_shape with a smaller D
|
||||
poly_shape(pv.x, pv.y, angle, D - 1, sat, rotation)
|
||||
poly_shape(pv.x, pv.y, angle, D - 1)
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
mode=Python
|
||||
mode.id=jycessing.mode.PythonMode
|
Ładowanie…
Reference in New Issue