-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathnoiseObject.pyde
64 lines (50 loc) · 1.74 KB
/
noiseObject.pyde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
######################
## General Settings ##
######################
w = 2000 # Canvas width
h = 2000 # canvas height
bgColor = color(255, 255, 255) # background color
penColor = color(0, 0, 0) # stroke color
thickness = 2 # stroke thickness in pixels
###########################
## Perlin Noise Settings ##
###########################
seeded = False # True to use specified noise seed
seed = 1
sca = 0.002 # noise scaling
detail = 10 # noise detail
mapMin = -1 # minimum value to map noise to
mapMax = 1 # maximum value to map noise to
#####################
## Object Settings ##
#####################
object_size = 800 # width and height boundaries of object
object_step = 200 # relates to number of curves created, used as step in loop
circle_logic = True # set to False to remove circles at end of curves
circle_size = 10 # diameter of circle
#######################
## object definition ##
#######################
def noiseThing(leng, step):
if seeded == True:
noiseSeed(seed)
else:
noiseSeed(int(random(100000)))
for i in range(-leng/2, leng/2 + step, step):
for j in range(-leng/2, leng/2 + step, step):
n = noise(i*sca, j*sca)
m = map(n, 0, 1, mapMin, mapMax)
i *= m*2
j *= m
bezier(0, 0, 0, j, i, 0, i, j) # experiment with control points (4 middle values)
if circle_logic == True:
circle(i, j, circle_size)
def setup():
size(w, h)
background(bgColor)
stroke(penColor)
strokeWeight(thickness)
noiseDetail(detail)
noFill()
translate(width/2, height/2)
noiseThing(object_size, object_step)