-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsketch.js
More file actions
executable file
·50 lines (37 loc) · 919 Bytes
/
sketch.js
File metadata and controls
executable file
·50 lines (37 loc) · 919 Bytes
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
var particles = [];
var limit = 11;
var imgs = [];
var gif;
function preload() {
var path = 'assets/';
//img 10 looks weird find way to handle
for (var i = 0; i < limit; i++){
imgs.push( loadGif(path + floor(random(1,10)) + '.gif'));
}
}
var cnv;
function centerCanvas() {
cnv = createCanvas(windowWidth, windowHeight);
var x = (windowWidth - width) / 2;
var y = (windowHeight - height) / 2;
cnv.position(x, y);
}
function windowResized() {
centerCanvas();
}
function setup() {
centerCanvas();
for (var i = 0; i < limit; i++){
var imgLoc = (floor(random(1,imgs.length)) - 1);
var img = imgs[i];
particles.push(new Particle(random(50,width-50), random(50, height-50), img));
}
}
function draw() {
background('#39424C');
for (var i = 0; i < limit; i++){
particles[i].separate(particles)
particles[i].update();
particles[i].display();
}
}