-
Notifications
You must be signed in to change notification settings - Fork 0
/
caricamento2.html
82 lines (67 loc) · 3.05 KB
/
caricamento2.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Loading</title>
<script src="libraries/p5.min.js"></script>
<script src="libraries/p5.sound.min.js"></script>
<script src="libraries/p5.serialport.js"></script>
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="https://use.typekit.net/cwg3cvo.css"> <!--Font Loos-->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta charset="UTF-8" />
</head>
<body>
<script>
//dopo 3 secondi ti manda alla pagina col gioco
window.setTimeout(function () {
// Move to a new location or you can do something else
window.location.href = "congrats.html";
}, 3000); //3000 = 3 secondi
let timerStart = 0; //variable to hold the start time of each iteration of the timer
let timerLength = 150; //length of the timer (in milliseconds)
let timerCount = 0; //number of times the timer has reset
let img = []; //make an array to hold image objects
let numImgs = 10; //variable to hold number of images
function preload() { //load images during preload
//load image objects as array elements
img[0] = loadImage('assets/micro/01.png');
img[1] = loadImage('assets/micro/02.png');
img[2] = loadImage('assets/micro/03.png');
img[3] = loadImage('assets/micro/04.png');
img[4] = loadImage('assets/micro/05.png');
img[5] = loadImage('assets/micro/06.png');
img[6] = loadImage('assets/micro/07.png');
img[7] = loadImage('assets/micro/08.png');
img[8] = loadImage('assets/micro/09.png');
img[9] = loadImage('assets/micro/10.png');
}
function setup() {
createCanvas(windowWidth, windowHeight);
push();
drawingContext.shadowOffsetX = 6;
drawingContext.shadowOffsetY = -6;
drawingContext.shadowBlur = 10;
drawingContext.shadowColor = 'black';
fill("white");
textFont('loos-normal');
textSize(35);
textAlign(CENTER);
text("Loading...", windowWidth / 2, windowHeight / 2 + 130);
pop();
}
function draw() {
//if the difference in the current time and the starting time of the timer is greater than the length of the timer
if (millis() - timerStart > timerLength) {
timerCount++; //increment the number of times the timer has reset
//reset timerCount so you don't overrun the number of items in your array
if (timerCount > numImgs) {
timerCount = 1;
}
//draw images to the canvas (the minus one is because arrays start their indexing from 0 not from 1)
image(img[timerCount - 1], windowWidth / 2 - 50, windowHeight / 2 - 80, 105);
timerStart = millis(); //reset start time of timer to new current time
}
}
</script>
</body>
</html>