-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
52 lines (43 loc) · 974 Bytes
/
main.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
var font;
var prompter;
var message = "";
var messageLength = 0;
var button;
var c;
function preload(){
font = loadFont("GreenLights.otf");
prompter = loadImage("ud prompter.jpg");
button = Document.getElementById("button");
}
function setup(){
c = createCanvas(500,500);
c.parent("container");
}
function draw(){
image(prompter, 0, 0, 500, 500);
fill(240, 58, 58);
textFont("GreenLights");
textAlign(CENTER, CENTER);
textSize(15);
translate(265,230);
angleMode(DEGREES);
rotate(-1);
text(message, 0, 0);
}
function screenshot() {
console.log("!");
saveCanvas(c, "UDPrompterImg", "jpg");
}
function keyPressed() {
if (keyCode == 8) {
message = message.slice(0, -1);
}
}
function keyTyped(){
if (messageLength <= 5500){
message = message + key;
}
for (x = 0; x < message.length; x++){
messageLength = messageLength + textWidth(message[x]);
}
}