Skip to content

Commit

Permalink
Added the concentric wobbles
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronpenne committed Oct 23, 2018
1 parent aeb5a0b commit 67df073
Show file tree
Hide file tree
Showing 3 changed files with 198 additions and 12 deletions.
149 changes: 149 additions & 0 deletions concentric_wobble/concentric_wobble.pyde
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
################################################################################
# Aaron Penne
# https://github.com/aaronpenne
################################################################################

import datetime
import string
import sys
from random import shuffle, seed

import helper

################################################################################
# Global variables
################################################################################

random_seed = int(random(0, 10000))
random_seed = helper.get_seed(random_seed)
helper.set_seed(random_seed)

# Get time
timestamp = datetime.datetime.now().strftime('%Y%m%d_%H%M%S')

# Parameters for draw speed
frame_rate = 30

################################################################################
# Knobs to turn
################################################################################

# Canvas size
w = 1000 # width
h = 1000 # height

opacity = 3

divisions = 6

a_step = PI/11
angles_1 = helper.range_float(0, TWO_PI, a_step)
a_step = PI/11
angles_2 = helper.range_float(0+TWO_PI/3, TWO_PI+TWO_PI/3, a_step)
a_step = PI/11
angles_3 = helper.range_float(0+2*TWO_PI/3, TWO_PI+2*TWO_PI/3, a_step)

offset = w*.02
offset_1 = [random(-offset, offset) for x in angles_1]
offset = w*.01
offset_2 = [random(-offset, offset) for x in angles_2]
offset = w*.01
offset_3 = [random(-offset, offset) for x in angles_3]

################################################################################
# setup()
# function gets run once at start of program
################################################################################

def setup():
# Sets size of canvas in pixels (must be first line)
size(w, h)

# Sets resolution dynamically (affects resolution of saved image)
pixelDensity(displayDensity()) # 1 for low, 2 for high

# Sets color space to Hue Saturation Brightness with max values of HSB respectively
colorMode(HSB, 360, 100, 100, 100)

# Set the number of frames per second to display
frameRate(frame_rate)

background(0, 0, 25)

# Stops draw() from running in an infinite loop (should be last line)
#noLoop() # Comment to run draw() infinitely (or until 'count' hits limit)


################################################################################
# draw()
# function gets run repeatedly (unless noLoop() called in setup())
################################################################################

def draw():
step = 100
if frameCount == step*2:
exit()

counter = frameCount * PI/step

background(0, 0, 25)
noFill()

x_center = w/2
y_center = h/2

print(frameCount)

# offset = [x*sin(counter) for x in offset_1]
# draw_concentric_wobble(2, 50, int(w*0.3), 0.01, offset, angles_1, w/2, h/2)


stroke(60, 7, 86)
angles = [x+counter/2 for x in angles_1]
offset = [x*sin(counter) for x in offset_1]
draw_concentric_wobble(1, 50, int(w*0.4), 0.01, offset, angles, w/2, h/2) #1*w/3

# stroke(60, 7, 86)
# angles = [x-counter/2 for x in angles_2]
# offset = [x*cos(counter) for x in offset_2]
# draw_concentric_wobble(2, 50, int(w*0.4), 0.01, offset, angles, w/2, h/2) # 2*w/3


helper.save_frame_timestamp('concentric_wobble', timestamp, random_seed)

# Save memory by closing image, just look at it in the file system
# if (w > 1000) or (h > 1000):
# exit()


################################################################################
# Functions
################################################################################

def mousePressed():
helper.save_frame_timestamp('concentric_wobble', timestamp, random_seed)

def draw_concentric_wobble(stroke_weight, r_start, r_end, r_offset, offset_list, angles_list, x_center, y_center):
strokeWeight(stroke_weight)

for r in range(r_start, r_end, 3*stroke_weight):
offset = [r_offset*r*x for x in offset_list]

beginShape()
x_0, y_0 = helper.circle_points(x_center, y_center, r, angles_list[0])
curveVertex(x_0 + offset[0], y_0 + offset[0])
x_1, y_1 = helper.circle_points(x_center, y_center, r, angles_list[1])
curveVertex(x_1 + offset[1], y_1 + offset[2])
x_2, y_2 = helper.circle_points(x_center, y_center, r, angles_list[2])
curveVertex(x_2 + offset[2], y_2 + offset[2])

for idx,a in enumerate(angles_list[3:-1]):
# radius = random_centered(radius, 30) # Randomize the radius a bit for each point
x, y = helper.circle_points(x_center, y_center, r, a)
curveVertex(x + offset[2+idx], y + offset[2+idx])

# Run the curve through the starting three points to ensure smooth connection at the end
curveVertex(x_0 + offset[0], y_0 + offset[0])
curveVertex(x_1 + offset[1], y_1 + offset[2])
curveVertex(x_2 + offset[2], y_2 + offset[2])
endShape()
2 changes: 2 additions & 0 deletions concentric_wobble/sketch.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mode=Python
mode.id=jycessing.mode.PythonMode
59 changes: 47 additions & 12 deletions fuzz/fuzz.pyde
Original file line number Diff line number Diff line change
Expand Up @@ -75,38 +75,73 @@ def setup():
################################################################################

def draw():
stroke(60, 7, 86, opacity)
noFill()

background(0, 0, 25)

stroke(342, 32, 85)
a = angles_1[frameCount]
#stroke(180, 100, 100, opacity) # cyan
#stroke(16.3, 28.6, 96.1) # salmon
x_circle, y_circle = helper.circle_points(w/2, h/2, 100, a)
for row in range(1, divisions):
for col in range(1, divisions):
strokeWeight(random(1, 5))
x = col * w/divisions
y = row * h/divisions
line(x, y, x_circle, y_circle)

stroke(60, 7, 86, opacity)
beginShape()
curveVertex(x, y)
curveVertex(x, y)
for idx in range(3):
x_rand = random(x, x_circle)
y_rand = random(y, y_circle)
curveVertex(x_rand, y_rand)
curveVertex(x_circle, y_circle)
curveVertex(x_circle, y_circle)
endShape()

stroke(41, 41, 66)
a = angles_2[frameCount]
#stroke(300, 100, 100, opacity) # magenta
#stroke(348.7, 50.4, 94.9) # bright salmon
#stroke(180, 100, 100, opacity) # cyan
#stroke(16.3, 28.6, 96.1) # salmon
x_circle, y_circle = helper.circle_points(w/2, h/2, 100, a)
for row in range(1, divisions):
for col in range(1, divisions):
strokeWeight(random(1, 5))
x = col * w/divisions
y = row * h/divisions
line(x, y, x_circle, y_circle)

stroke(60, 7, 86, opacity)
beginShape()
curveVertex(x, y)
curveVertex(x, y)
for idx in range(3):
x_rand = random(x, x_circle)
y_rand = random(y, y_circle)
curveVertex(x_rand, y_rand)
curveVertex(x_circle, y_circle)
curveVertex(x_circle, y_circle)
endShape()

stroke(98, 19, 87)
a = angles_3[frameCount]
#stroke(60, 100, 100, opacity) # yellow
#stroke(45.7, 78.8, 94.1) # yellow
#stroke(180, 100, 100, opacity) # cyan
#stroke(16.3, 28.6, 96.1) # salmon
x_circle, y_circle = helper.circle_points(w/2, h/2, 100, a)
for row in range(1, divisions):
for col in range(1, divisions):
strokeWeight(random(1, 5))
x = col * w/divisions
y = row * h/divisions
line(x, y, x_circle, y_circle)
beginShape()
curveVertex(x, y)
curveVertex(x, y)
for idx in range(3):
x_rand = random(x, x_circle)
y_rand = random(y, y_circle)
curveVertex(x_rand, y_rand)
curveVertex(x_circle, y_circle)
curveVertex(x_circle, y_circle)
endShape()


#helper.save_frame_timestamp('fuzz', timestamp, random_seed)

Expand Down

0 comments on commit 67df073

Please sign in to comment.