-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsketch.js
58 lines (48 loc) · 1.02 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const SCREEN_WIDTH = window.innerWidth;
const SCREEN_HEIGHT = window.innerHeight;
let fr = 30;
function preload() {
initHud();
initInteraction();
//initTypeSoundMapping();
initTypeIconMapping();
initGameState();
initHandsData();
}
function setup() {
let cv = createCanvas(SCREEN_WIDTH, SCREEN_HEIGHT);
cv.mousePressed(tryDiffuse);
frameRate(fr);
initHandDisplay();
}
function draw() {
background(59, 57, 55);
updateHandCollections();
checkEndGame();
hands.forEach((h) => h.update(1));
}
function getRandomPosition() {
return createVector(
Math.random() * SCREEN_WIDTH,
Math.random() * SCREEN_HEIGHT
);
}
function mousePressed() {
//userStartAudio();
}
function tryDiffuse() {
if (diffusionAllowed()) {
diffuse(createVector(mouseX, mouseY));
}
}
function initHandDisplay() {
background(59, 57, 55);
initHands();
hands.forEach((h) => h.display());
}
function pauseDraw() {
noLoop();
}
function resumeDraw() {
loop();
}