-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsketch.js
More file actions
67 lines (53 loc) · 1.35 KB
/
sketch.js
File metadata and controls
67 lines (53 loc) · 1.35 KB
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
65
66
67
const TOTAL = 300;
let points = [];
// preload img:
let img;
// fonts:
let font
function preload() {
img = loadImage("img/goodguygregory.png");
newFont = loadFont('fonts/Oxygen-Bold.ttf')
}
function setup() {
let canvas = createCanvas(windowWidth, 800);
canvas.parent('sketch-holder');
for (var i = 0; i < TOTAL; i++) {
points.push({
pos: createVector(700, 330),
dir: random(TWO_PI),
size: random(0, 30),
color: color(random(20, 255), random(20, 255), random(20, 255))
});
}
background(50);
}
function draw() {
image(img, 470, 120, 450, 450);
fill(255);
stroke(0);
textFont(newFont);
textSize(68);
text("Greg Witt", 40, 435);
textSize(35)
// add time to the equation:
var time = millis() / 1000;
let i = 0;
while (i < TOTAL) {
var point = points[i];
// trick 2:
point.dir += noise(point.pos.x, point.pos.y, time) - 0.477;
//trick 1
point.pos.x += cos(point.dir);
point.pos.y += sin(point.dir);
// Constrainted Values:
// TODO:
// random size and random color:
noStroke();
fill(point.color);
ellipse(point.pos.x, point.pos.y, point.size);
i++;
}
}
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
}