forked from Vauhtijuoksu/EndingCredits
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
37 lines (27 loc) · 880 Bytes
/
Copy pathscript.js
File metadata and controls
37 lines (27 loc) · 880 Bytes
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
const scrnsize = 1080
let scrollpos = scrnsize
let html = ''
for (let i = 0; i < credits.length; i++){
html += '<div class="' + credits[i]["type"] + '">'+ credits[i]["text"] + '</div>'
}
document.getElementById('scroll').innerHTML = html
document.getElementById('end').innerHTML = endtext
let opacity = 0;
let do_fadein
let do_scroll = setInterval(scrollup, 5)
function scrollup(){
scrollpos -= (scrnsize/scrolltime)*0.005
document.getElementById('scroll').style.top = scrollpos + "px"
if (scrollpos < -document.getElementById('scroll').offsetHeight){
clearInterval(do_scroll)
do_fadein = setInterval(fadein, 10)
}
}
function fadein(){
document.getElementById("end").style.opacity = opacity;
opacity += 0.003;
if (opacity > 1){
document.getElementById("end").style.opacity = 1;
clearInterval(do_fadein)
}
}