Browse Source

Merge commit '3f0824377c'

master
farhan 4 months ago
parent
commit
2c7f255898

+ 24
- 15
resources/css/app.css View File

@@ -60,8 +60,6 @@ body.no-scroll {
60 60
     z-index: 1;
61 61
     /* Ensures it is on top of other elements */
62 62
     opacity: 0.3;
63
-    /* Set the opacity to a lower value */
64
-    display: block;
65 63
 }
66 64
 
67 65
 .petal-overlay img {
@@ -105,10 +103,13 @@ body.no-scroll {
105 103
     box-shadow: 0 0 0 0 #fff;
106 104
 }
107 105
 
108
-.part{
106
+.part {
109 107
     transition: all 0.1s ease-in-out;
110 108
 }
111 109
 
110
+
111
+
112
+
112 113
 @keyframes pulsIn {
113 114
     0% {
114 115
         box-shadow: inset 0 0 0 1rem #fff;
@@ -136,22 +137,30 @@ body.no-scroll {
136 137
     }
137 138
 }
138 139
 
140
+@keyframes to-left {
141
+    from {
142
+        transform: translateX(0)
143
+    }
144
+
145
+    to {
146
+        transform: translateX(-100%)
147
+    }
148
+}
149
+
139 150
 @keyframes to-right {
140 151
     from {
141
-       transform: translateX(0)
152
+        transform: translateX(0)
142 153
     }
154
+
143 155
     to {
144 156
         transform: translateX(100%)
145
-     }
146
-  }
157
+    }
158
+}
147 159
 
160
+.to-left-animation{
161
+    animation: to-left 2s forwards;
162
+}
148 163
 
149
-@media (prefers-reduced-motion: no-preference) {
150
-    @supports (animation-timeline: scroll()) {
151
-      #right-cover {
152
-        animation: to-right linear both;
153
-        animation-timeline: scroll();
154
-        animation-range: contain;
155
-      }
156
-    }
157
-  }
164
+.to-right-animation{
165
+    animation: to-right 2s forwards;
166
+}

+ 115
- 114
resources/js/app.js View File

@@ -3,59 +3,11 @@ import './bootstrap';
3 3
 import '@fortawesome/fontawesome-free/css/all.min.css';
4 4
 
5 5
 
6
-//Countdown date (adjust this date to your desired countdown target)
7
-const countdownDate = new Date('2024-08-17T11:00:00').getTime();
8
-
9
-//Update the countdown every second
10
-const countdownElement = document.getElementById('countdown');
11
-const countdownTimer = setInterval(() => {
12
-    //Get the current date and time
13
-    const now = new Date().getTime();
14
-
15
-    //Calculate the time remaining
16
-    const distance = countdownDate - now;
17
-
18
-    //Calculate days, hours, minutes, and seconds
19
-    const days = Math.floor(distance / (1000 * 60 * 60 * 24));
20
-    const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
21
-    const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
22
-    const seconds = Math.floor((distance % (1000 * 60)) / 1000);
23
-
24
-    //Format the countdown into a string
25
-    const countdownHTML = `
26
-        <div class="flex flex-col">
27
-            <div class="flex gap-8 justify-center">
28
-                <div class="font-medium text-gray-500">${days}</div>
29
-                <div class="font-medium text-gray-500">:</div>
30
-                <div class="font-medium text-gray-500">${hours.toString().padStart(2, '0')}</div>
31
-                <div class="font-medium text-gray-500">:</div>
32
-                <div class="font-medium text-gray-500">${minutes.toString().padStart(2, '0')}</div>
33
-                <div class="font-medium text-gray-500">:</div>
34
-                <div class="font-medium text-gray-500">${seconds.toString().padStart(2, '0')}</div>
35
-            </div>
36
-            <div class="flex gap-14 justify-center">
37
-                <div class="font-medium text-gray-600">Hari</div>
38
-                <div class="font-medium text-gray-600">Jam</div>
39
-                <div class="font-medium text-gray-600">Minit</div>
40
-                <div class="font-medium text-gray-600">Saat</div>
41
-            </div>
42
-        </div>
43
-    `;
44
-
45
-    //Display the countdown in the element
46
-    countdownElement.innerHTML = countdownHTML;
47
-
48
-    //If the countdown is over, clear the timer and display a message
49
-    if (distance < 0) {
50
-        clearInterval(countdownTimer);
51
-        countdownElement.innerHTML = 'Majlis berlangsung';
52
-    }
53
-}, 1000); // Update every second (1000 milliseconds)
54 6
 
55 7
 document.addEventListener('DOMContentLoaded', function () {
56
-    imageLoading()
57
-    scrollOpenCover()
58 8
 
9
+    imageLoading()
10
+    scrollOpenCover();
59 11
     reset() // reset everrything to ensure smooth
60 12
     sessionStorage.setItem("initial-load", "true"); // will be used by click event
61 13
 
@@ -66,48 +18,82 @@ document.addEventListener('click', function () {
66 18
 
67 19
     let initLoad = sessionStorage.getItem("initial-load")
68 20
 
69
-
70 21
     // parts is intro cover
71 22
     let parts = document.getElementsByClassName("part");
72 23
     for (let part of parts) {
73 24
         part.classList.add("shadow-lg")
74 25
     }
75 26
 
76
-    let body = document.querySelector("body");
77
-    body.classList.remove("no-scroll");
78
-
79 27
     // the intro - only done once and
80 28
     if (initLoad == "true") {
81 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
+
82 47
         sessionStorage.removeItem("initial-load")
83
-        // delay timer to have that umpph feels my G
84
-        setTimeout(() => {
85
-            // smooth scroll only happen for first render
86
-            smoothScrollBy(100, 3500);
87
-        }, 500)
88 48
     }
89 49
 
50
+    setTimeout(() => {
51
+        eventCountdown();
52
+        let petalOverlay = document.getElementById("petalOverlay");
53
+        petalOverlay.classList.remove("hidden");
54
+    }, 2000)
55
+
90 56
 });
91 57
 
92
-function smoothScrollBy(distance, duration) {
93
-    const start = window.pageYOffset;
94
-    const startTime = performance.now();
58
+// to ensure all images is loaded before starting animation and gimmick
59
+function imageLoading() {
60
+    const images = document.querySelectorAll("img");
61
+    let loadedCount = 0;
62
+    const totalImages = images.length;
63
+
64
+    images.forEach(image => {
65
+        if (image.complete) {
66
+            loadedCount++;
67
+        } else {
68
+            image.addEventListener("load", () => {
69
+                loadedCount++;
70
+                checkAllImagesLoaded();
71
+            });
72
+            image.addEventListener("error", () => {
73
+                loadedCount++;
74
+                checkAllImagesLoaded();
75
+            });
76
+        }
77
+    });
95 78
 
96
-    function scroll() {
97
-        const now = performance.now();
98
-        const time = Math.min(1, (now - startTime) / duration);
99
-        const timeFunction = time * (2 - time); // Ease out effect
100
-        window.scrollTo(0, start + timeFunction * distance);
79
+    function checkAllImagesLoaded() {
101 80
 
102
-        if (time < 1) {
103
-            requestAnimationFrame(scroll);
81
+        if (loadedCount === totalImages) {
82
+            let loading = document.getElementById("loading");
83
+            loading.remove();
84
+            // parts is intro cover
85
+            let parts = document.getElementsByClassName("part");
86
+            for (let part of parts) {
87
+                part.classList.remove("hidden")
88
+            }
104 89
         }
105 90
     }
106 91
 
107
-    requestAnimationFrame(scroll);
92
+    //somehow the server work so fast, script doesn't have much time to set the load eventlistener
93
+    //thus we check here, to ensure checkAllImagesLoaded run
94
+    checkAllImagesLoaded();
108 95
 }
109 96
 
110
-
111 97
 // enable open close cover
112 98
 function scrollOpenCover() {
113 99
     var partLeftPos = 0;
@@ -151,53 +137,16 @@ function scrollOpenCover() {
151 137
     });
152 138
 }
153 139
 
154
-// to ensure all images is loaded before starting animation and gimmick
155
-function imageLoading() {
156
-    const images = document.querySelectorAll("img");
157
-    let loadedCount = 0;
158
-    const totalImages = images.length;
159
-
160
-    images.forEach(image => {
161
-        if (image.complete) {
162
-            loadedCount++;
163
-        } else {
164
-            image.addEventListener("load", () => {
165
-                loadedCount++;
166
-                checkAllImagesLoaded();
167
-            });
168
-            image.addEventListener("error", () => {
169
-                loadedCount++;
170
-                checkAllImagesLoaded();
171
-            });
172
-        }
173
-    });
174
-
175
-    function checkAllImagesLoaded() {
176
-        if (loadedCount === totalImages) {
177
-            let loading = document.getElementById("loading");
178
-            loading.remove();
179
-            // parts is intro cover
180
-            let parts = document.getElementsByClassName("part");
181
-            for (let part of parts) {
182
-                part.classList.remove("hidden")
183
-            }
184
-
185
-        }
186
-    }
187
-}
188
-
189 140
 function reset() {
141
+
190 142
     // reset to top
191 143
     let body = document.querySelector("body");
192
-    body.classList.remove("no-scroll");
193
-    window.scrollTo(0, 0);
144
+    window.scrollTo(0, document.body.scrollHeight * 0.05);
145
+    body.classList.add("no-scroll");
194 146
 
195
-    setTimeout(() => {
196
-        body.classList.add("no-scroll");
197
-    }, 500)
198 147
 }
199 148
 
200
-function playMusic(){
149
+function playMusic() {
201 150
     var audioElement = document.getElementById('player');
202 151
     var hasPlayed = false;
203 152
     if (!hasPlayed) {
@@ -205,13 +154,65 @@ function playMusic(){
205 154
         var playPromise = audioElement.play();
206 155
 
207 156
         if (playPromise !== undefined) {
208
-            playPromise.then(function() {
157
+            playPromise.then(function () {
209 158
                 // Automatic playback started!
210 159
                 hasPlayed = true; // Prevent further attempts to play
211
-            }).catch(function(error) {
160
+            }).catch(function (error) {
212 161
                 // Automatic playback failed.
213 162
                 console.log('Autoplay failed: ' + error);
214 163
             });
215 164
         }
216 165
     }
217 166
 }
167
+
168
+function eventCountdown() {
169
+
170
+    //Countdown date (adjust this date to your desired countdown target)
171
+    const countdownDate = new Date('2024-08-17T11:00:00').getTime();
172
+
173
+    //Update the countdown every second
174
+    const countdownElement = document.getElementById('countdown');
175
+    const countdownTimer = setInterval(() => {
176
+        //Get the current date and time
177
+        const now = new Date().getTime();
178
+
179
+        //Calculate the time remaining
180
+        const distance = countdownDate - now;
181
+
182
+        //Calculate days, hours, minutes, and seconds
183
+        const days = Math.floor(distance / (1000 * 60 * 60 * 24));
184
+        const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
185
+        const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
186
+        const seconds = Math.floor((distance % (1000 * 60)) / 1000);
187
+
188
+        //Format the countdown into a string
189
+        const countdownHTML = `
190
+        <div class="flex flex-col">
191
+            <div class="flex gap-8 justify-center">
192
+                <div class="font-medium text-gray-500">${days}</div>
193
+                <div class="font-medium text-gray-500">:</div>
194
+                <div class="font-medium text-gray-500">${hours.toString().padStart(2, '0')}</div>
195
+                <div class="font-medium text-gray-500">:</div>
196
+                <div class="font-medium text-gray-500">${minutes.toString().padStart(2, '0')}</div>
197
+                <div class="font-medium text-gray-500">:</div>
198
+                <div class="font-medium text-gray-500">${seconds.toString().padStart(2, '0')}</div>
199
+            </div>
200
+            <div class="flex gap-14 justify-center">
201
+                <div class="font-medium text-gray-600">Hari</div>
202
+                <div class="font-medium text-gray-600">Jam</div>
203
+                <div class="font-medium text-gray-600">Minit</div>
204
+                <div class="font-medium text-gray-600">Saat</div>
205
+            </div>
206
+        </div>
207
+    `;
208
+
209
+        //Display the countdown in the element
210
+        countdownElement.innerHTML = countdownHTML;
211
+
212
+        //If the countdown is over, clear the timer and display a message
213
+        if (distance < 0) {
214
+            clearInterval(countdownTimer);
215
+            countdownElement.innerHTML = 'Majlis berlangsung';
216
+        }
217
+    }, 1000); // Update every second (1000 milliseconds)
218
+}

+ 22
- 0
resources/views/components/front-cover-intro-dummy.blade.php View File

@@ -0,0 +1,22 @@
1
+<div class="part left-dummy fixed left-0 w-1/2 h-screen bg-babyblue hidden">
2
+    <div class="flex flex-col justify-center h-full gap-10">
3
+        <div class="flex justify-end items-center animate__animated animate__fadeIn animate__delay-1s">
4
+            <img src="{{ asset('assets/logo-left.webp') }}" alt="Logo" class="logo-img">
5
+        </div>
6
+        <div class="flex justify-end items-center animate__animated animate__fadeIn animate__delay-1s">
7
+            <img src="{{ asset('assets/name-left.webp') }}" alt="Name Left" class="logo-img">
8
+        </div>
9
+        <img src="{{asset('assets/flower-left.webp')}}" alt="" class="absolute -left-2/4 top-72 h-96 w-96 animate__animated animate__fadeIn animate__delay-2s">
10
+    </div>
11
+</div>
12
+<div class="part right-dummy fixed right-0 w-1/2 h-screen bg-babyblue hidden">
13
+    <div class="flex flex-col justify-center h-full gap-10">
14
+        <div class="flex justify-start items-center animate__animated animate__fadeIn animate__delay-1s">
15
+            <img src="{{ asset('assets/logo-right.webp') }}" alt="Logo" class="logo-img">
16
+        </div>
17
+        <div class="flex justify-start items-center animate__animated animate__fadeIn animate__delay-1s">
18
+            <img src="{{ asset('assets/name-right.webp') }}" alt="Name Right" class="logo-img">
19
+        </div>
20
+        <img src="{{asset('assets/flower-right.webp')}}" alt="" class="absolute -right-2/4 top-32 h-96 w-96 animate__animated animate__fadeIn animate__delay-2s">
21
+    </div>
22
+</div>

+ 4
- 1
resources/views/digital-card.blade.php View File

@@ -32,7 +32,10 @@
32 32
         <div class="parent absolute h-screen w-screen" style="z-index: 999">
33 33
             @include('components.front-cover')
34 34
         </div>
35
-        <div class="petal-overlay" id="petalOverlay">
35
+        <div class="parent absolute h-screen w-screen dummy-cover" style="z-index: 999">
36
+            @include('components.front-cover-intro-dummy')
37
+        </div>
38
+        <div class="petal-overlay hidden" id="petalOverlay">
36 39
             <img src="{{ asset('assets/petal.gif') }}" alt="Falling Petals">
37 40
         </div>
38 41
         <div class="section bg-babyblue min-h-screen flex justify-center items-center pb-20">

Loading…
Cancel
Save