-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsketch1.js
More file actions
60 lines (54 loc) · 1.89 KB
/
Copy pathsketch1.js
File metadata and controls
60 lines (54 loc) · 1.89 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
//this is the landing page
let myFont;
let myFontitalic;
function preload() {
myFont = loadFont("assets/nimbus.ttf");
myFontitalic = loadFont("assets/nimbusitalic.ttf");
}
function setup() {
createCanvas(windowWidth, windowHeight);
frameRate(1);
textAlign(CENTER);
}
function draw() {
background(255);
fill(0);
//if condition to make text responsive
if (windowWidth < 400) {
textSize(80);
textFont(myFont);
text("VOLUME", width / 2, height / 2 - height / 11);
textSize(10);
textFont(myFontitalic);
text(
"Volume refers to the variation of the sound measured in decibels. It can also be defined as the audio level to determine the loudness of the sound. The term can be used technically for instruments and instruments such as radio, television and other things.",
//textAlign not working with uploaded font, so we used percentage to center the text
width / 2 - width / 3.5,
height / 2,
(width * 3) / 5
);
//if condition to make text responsive
} else if (windowWidth > 400) {
textSize(150);
textFont(myFont);
text("VOLUME", width / 2, height / 2 - height / 11);
textSize(30);
textFont(myFontitalic);
text(
"<<Volume refers to the variation of the sound measured in decibels. It can also be defined as the audio level to determine the loudness of the sound. The term can be used technically for instruments and instruments such as radio, television and other things.>>",
//textAlign not working with uploaded font, so we used percentage to center the text
width / 2 - width / 3.5,
height / 2,
(width * 3) / 5
);
}
//make the text blue to pop out more
push();
fill("blue");
text("CLICK ANYWHERE", random(width), random(height));
pop();
}
//redirect to another page when mouse is clicked or screen is touched
function mouseClicked() {
window.location.href = "index2.html";
}