|
@@ -24,47 +24,37 @@ document.addEventListener('click', function () {
|
24
|
24
|
part.classList.add("shadow-lg")
|
25
|
25
|
}
|
26
|
26
|
|
27
|
|
- let body = document.querySelector("body");
|
28
|
|
- body.classList.remove("no-scroll");
|
29
|
|
-
|
30
|
27
|
// the intro - only done once and
|
31
|
28
|
if (initLoad == "true") {
|
32
|
29
|
playMusic();
|
|
30
|
+
|
|
31
|
+ let leftCover = document.querySelector(".dummy-cover .left-dummy");
|
|
32
|
+ let rightCover = document.querySelector(".dummy-cover .right-dummy");
|
|
33
|
+ leftCover.classList.add("to-left-animation")
|
|
34
|
+ rightCover.classList.add("to-right-animation")
|
|
35
|
+ setTimeout(()=>{
|
|
36
|
+ //dummy-cover
|
|
37
|
+ let parts = document.querySelectorAll(".dummy-cover .part");
|
|
38
|
+ for (let part of parts) {
|
|
39
|
+ part.remove("hidden")
|
|
40
|
+ }
|
|
41
|
+
|
|
42
|
+ let body = document.querySelector("body");
|
|
43
|
+ body.classList.remove("no-scroll");
|
|
44
|
+
|
|
45
|
+ },2500)
|
|
46
|
+
|
33
|
47
|
sessionStorage.removeItem("initial-load")
|
34
|
|
- // delay timer to have that umpph feels my G
|
35
|
|
- setTimeout(() => {
|
36
|
|
- // smooth scroll only happen for first render
|
37
|
|
- smoothScrollBy(100, 3500);
|
38
|
|
- }, 600)
|
39
|
48
|
}
|
40
|
49
|
|
41
|
50
|
setTimeout(() => {
|
42
|
51
|
eventCountdown();
|
43
|
52
|
let petalOverlay = document.getElementById("petalOverlay");
|
44
|
53
|
petalOverlay.classList.remove("hidden");
|
45
|
|
-
|
46
|
|
- }, 5000)
|
|
54
|
+ }, 2000)
|
47
|
55
|
|
48
|
56
|
});
|
49
|
57
|
|
50
|
|
-function smoothScrollBy(distance, duration) {
|
51
|
|
- const start = window.pageYOffset;
|
52
|
|
- const startTime = performance.now();
|
53
|
|
-
|
54
|
|
- function scroll() {
|
55
|
|
- const now = performance.now();
|
56
|
|
- const time = Math.min(1, (now - startTime) / duration);
|
57
|
|
- const timeFunction = time * (2 - time); // Ease out effect
|
58
|
|
- window.scrollTo(0, start + timeFunction * distance);
|
59
|
|
-
|
60
|
|
- if (time < 1) {
|
61
|
|
- requestAnimationFrame(scroll);
|
62
|
|
- }
|
63
|
|
- }
|
64
|
|
-
|
65
|
|
- requestAnimationFrame(scroll);
|
66
|
|
-}
|
67
|
|
-
|
68
|
58
|
// to ensure all images is loaded before starting animation and gimmick
|
69
|
59
|
function imageLoading() {
|
70
|
60
|
const images = document.querySelectorAll("img");
|
|
@@ -151,12 +141,9 @@ function reset() {
|
151
|
141
|
|
152
|
142
|
// reset to top
|
153
|
143
|
let body = document.querySelector("body");
|
154
|
|
- body.classList.remove("no-scroll");
|
155
|
|
- window.scrollTo(0, 0);
|
|
144
|
+ window.scrollTo(0, document.body.scrollHeight * 0.05);
|
|
145
|
+ body.classList.add("no-scroll");
|
156
|
146
|
|
157
|
|
- setTimeout(() => {
|
158
|
|
- body.classList.add("no-scroll");
|
159
|
|
- }, 100)
|
160
|
147
|
}
|
161
|
148
|
|
162
|
149
|
function playMusic() {
|