Created
February 27, 2019 22:54
-
-
Save ondrejzacha/930f4446977e46b4b50b451308d61f6c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NO_POINTS = 5 | |
def setup(): | |
fullScreen() | |
frameRate(15) | |
background(0) | |
def draw(): | |
# background(255) | |
stroke(255, 10) | |
for r in range(50, 800, 50): | |
pseudo_circle(radius=r, circle_center=(width/2, height/2), no_points=NO_POINTS) | |
def mousePressed(): | |
background(0) | |
def pseudo_circle(radius, circle_center, no_points=8): | |
xs = [] | |
ys = [] | |
noise_values = [] | |
for i in range(no_points + 3): | |
if i < no_points: | |
angle = 0.1*frameCount/TWO_PI + TWO_PI * i/(no_points * 1.) * map(noise(i + 0.01*frameCount), 0, 1, 0.9, 1.1) | |
radius_noise = map(noise(i + 0.01*frameCount), 0, 1, 0.1, 3) | |
x_ = circle_center[0] + cos(angle) * radius * radius_noise | |
y_ = circle_center[1] + sin(angle) * radius * radius_noise | |
else: | |
# these are necessary to finish the shape | |
x_ = xs[i % no_points] | |
y_ = ys[i % no_points] | |
# ellipse(x_, y_, 10, 10) | |
xs += [x_] | |
ys += [y_] | |
xys = zip(xs, ys) | |
line_sequence(*xys) | |
def line_sequence(*args): | |
noFill() | |
beginShape() | |
for x in args: | |
curveVertex(*x) | |
endShape() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment