diff --git a/s068/s068.pyde b/s068/s068.pyde index 8b8317fc..63e303cf 100644 --- a/s068/s068.pyde +++ b/s068/s068.pyde @@ -1,21 +1,24 @@ """ -sketch 67 180308 - Alexandre B A Villares +sketch 68 180309 - Alexandre B A Villares https://abav.lugaralgum.com/sketch-a-day """ from __future__ import division from slider import Slider -i = Slider(PI / 6, TWO_PI / 3, QUARTER_PI) -j = Slider(1, 4, 2) -k = Slider(10, 50, 25) - -I, J, K = 1, 1, 1 # dummy initial slider values +# slider_object = Slider(lowest, highest, initial value) +i = Slider(PI / 6, TWO_PI / 3, QUARTER_PI) # angle, changes number of sides +j = Slider(1, 4, 2) # depth, changes number of recursions (fiddled afterwards) +k = Slider(10, 50, 25) # offset, changes scale +I, J, K = 1, 1, 1 # dummy initial slider global values +# ^ I need these globals because I want to read/draw sliders +# at the end of the draw loop so they draw on top def setup(): size(600, 600) - colorMode(HSB) + colorMode(HSB) # makes it easy to cycle colors through Hues... noFill() + # Position Sliders (x, y) i.position(20, 20) j.position(20, 60) k.position(20, 100) @@ -26,18 +29,19 @@ def draw(): poly_shape(width / 2, height/2, I, J, K) # Read and update sliders I = i.value() # from PI/6 to TWO_PI/3 - j.high = 3 + I * 1.5 # change J's upper limit + j.high = 3 + I * 1.5 # change J's upper limit... J = j.value() # 1 to 3 + I * 1.5 K = k.value() # 10 to 50 - #if not frameCount % 100: saveFrame("s####.tga") + #if not frameCount % 100: saveFrame("s####.tga") # uncomment to save frames! def poly_shape(x, y, angle, D, offset): stroke((frameCount / 2 * D) % 256, 255, 255, 255) strokeWeight(D) with pushMatrix(): translate(x, y) - # rotate(radians(30)) + # rotate(radians(30)) # saved for the next day ;) ! radius = D * offset + # create a polygon on a ps PShape object ps = createShape() ps.beginShape() a = 0 @@ -46,9 +50,11 @@ def poly_shape(x, y, angle, D, offset): sy = sin(a) * radius ps.vertex(sx, sy) a += angle - ps.endShape(CLOSE) - shape(ps, 0, 0) - if D > 1: + ps.endShape(CLOSE) # end of PShape creation + shape(ps, 0, 0) # Draw the PShape + if D > 1: # if the recursion 'distance'/'depth' allows... for i in range(ps.getVertexCount()): - pv = ps.getVertex(i) # PVector + # 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, offset) diff --git a/s068/slider$py.class b/s068/slider$py.class new file mode 100644 index 00000000..2e3fe395 Binary files /dev/null and b/s068/slider$py.class differ