forked from yining1023/brickBreaker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpics.js
104 lines (83 loc) · 2.29 KB
/
pics.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
let soundtrack;
let inconsolata;
let lastLineHeight = 0;
const LINE_HEIGHT = 28;
let pics_bg;
function preload() {
soundtrack = loadSound('assets/SpiegelImSpiegelMonoShort.mp3');
inconsolata = loadFont('assets/inconsolata.otf');
}
function setup() {
setupCanvas(false);
soundtrack.loop();
cursor(HAND);
pics_bg = loadImage('sprites/pics/pics_crepes_background.png');
}
function draw() {
lastLineHeight = 0;
background(pics_bg);
textFont(inconsolata);
textSize(30);
push();
if(mouseX>width/2){
translate(mouseX-width/4, mouseY-height/13);
}else{
translate(width*0.6, height*1.5/4);
}
if(BWB_LANG == BWB_LANG_EN) {
addHeading(' MAKING OF');
addParagraphOtherColor('Head to the gallery');
} else {
addHeading(' LES COULISSES');
addParagraphOtherColor('Aller à la galerie');
}
addLineBreak();
pop();
push();
if(mouseX<=width/2){
translate(mouseX-width/8, mouseY-height/4.5);
}else{
translate(width/5, height/3);
}
if(BWB_LANG == BWB_LANG_EN) {
addHeading('BACK HOME');
addParagraph('Replay :)');
} else {
addHeading('REVENIR');
addParagraph('Rejouer :)');
}
addLineBreak();
pop();
}
function addLineBreak() {
lastLineHeight += LINE_HEIGHT;
}
function addHeading(msg) {
lastLineHeight += LINE_HEIGHT;
fill(0);
text(msg, 11, lastLineHeight+1);
fill(lerp(100,255,abs(sin(PI*(frameCount%300)/300))));
text(msg, 10, lastLineHeight);
}
function addParagraph(msg) {
lastLineHeight += LINE_HEIGHT;
fill(0);
text(msg, 11, lastLineHeight+1);
fill(lerpColor(color(0,255,255), color(255,0,255), abs(sin(PI*(frameCount%300)/300))));
text(msg, 10, lastLineHeight);
}
function addParagraphOtherColor(msg) {
lastLineHeight += LINE_HEIGHT;
fill(0);
text(msg, 11, lastLineHeight+1);
fill(lerpColor(color(255,255,0), color(0,255,0), abs(sin(PI*(frameCount%300)/300))));
text(msg, 10, lastLineHeight);
}
function mouseReleased() {
userStartAudio(); // Chrome hack
if (mouseX < width/2 && mouseX > 0 && mouseY < height && mouseY > 0) {
redirectToUrlFor('home');
} else if (mouseX >= width/2 && mouseX > 0 && mouseY < height && mouseY > 0) {
redirectToUrlFor('gallery');
}
}