Created
March 2, 2019 13:13
-
-
Save ondrejzacha/7e51713fc49be54603da9eb6b253d0c0 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 = 9 | |
def setup(): | |
fullScreen() | |
frameRate(15) | |
background(0) | |
def draw(): | |
background(0) | |
stroke(255) | |
for r in range(50, 800, 25): | |
stroke(255, 185- r * 255/800) | |
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/9 + 0.01*frameCount), 0, 1, 0.1, 2) | |
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