-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsketch.js
38 lines (33 loc) · 867 Bytes
/
sketch.js
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
const RADIUS = 100;
let pallete = [];
let side;
const layers = []
const flowers = []
const scale = 100;
const noiseThreshold = .6;
function setup() {
side = randomSelectTwo() ? 6 : 12;
createCanvas(windowWidth - 20, windowHeight - 20);
pallete = [
color(234, 157, 52), // gold
color(215, 130, 126), // rose
color(86, 148, 159), // Foam
color(144, 122, 169), // iris
]
rectMode(CENTER);
for (var x = 0; x < width; x += scale) {
for (var y = 0; y < height; y += scale) {
var c = noise(0.01 * x, 0.01 * y);
if (c > noiseThreshold) {
flowers.push(new Flower(map(c, noiseThreshold, 1, 30, 200), x, y));
}
}
}
}
function draw() {
background(color(255, 250, 243));
flowers.forEach(flower => {
flower.render()
}
);
}