-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrainbow_dragon.pde
52 lines (46 loc) · 982 Bytes
/
rainbow_dragon.pde
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
Brush brush;
void setup() {
size(800, 800);
background(255, 255, 0);
colorMode(HSB);
brush = new Brush();
}
void draw() {
brush.draw();
brush.update();
}
class Brush{
PVector location;
float angle;
float hu;
float size;
float seedX,seedY, seedAngle, seedHu, seedSize;
Brush() {
seedX = random(10);
seedY = random(10);
seedAngle = random(10);
seedHu = random(10);
seedSize = random(10);
location = new PVector();
}
void draw() {
pushMatrix();
fill(hu, 360, 360, 100);
translate(location.x,location.y);
rotate(angle);
rect(0, 0, size, size);
popMatrix();
}
void update() {
location.x = map(noise(seedX), 0, 1, 0, width);
location.y = map(noise(seedY), 0, 1, 0, height);
angle = map(noise(seedAngle), 0, 1, 0, TWO_PI);
hu= map(noise(seedAngle,seedSize), 0, 1, 0, 360);
size = map(noise(seedSize), 0, 1, 0,100);
seedX += 0.01;
seedY += 0.01;
seedAngle += 0.01;
seedHu += 0.01;
seedSize += 0.01;
}
}