Spaces:
Running
Running
scatter smiley on the screen also they should drop slowly - Follow Up Deployment
Browse files- index.html +18 -15
index.html
CHANGED
|
@@ -30,15 +30,17 @@
|
|
| 30 |
to { opacity: 1; }
|
| 31 |
}
|
| 32 |
.falling-smiley {
|
| 33 |
-
position:
|
| 34 |
font-size: 2rem;
|
| 35 |
animation: fall linear forwards;
|
| 36 |
z-index: 10;
|
| 37 |
pointer-events: none;
|
|
|
|
| 38 |
}
|
| 39 |
@keyframes fall {
|
| 40 |
to {
|
| 41 |
transform: translateY(100vh);
|
|
|
|
| 42 |
}
|
| 43 |
}
|
| 44 |
</style>
|
|
@@ -56,7 +58,6 @@
|
|
| 56 |
<div class="relative aspect-video bg-gray-200 rounded-lg overflow-hidden mb-4">
|
| 57 |
<video id="video" width="100%" height="100%" autoplay muted class="object-cover"></video>
|
| 58 |
<canvas id="canvas" class="absolute top-0 left-0 w-full h-full pointer-events-none"></canvas>
|
| 59 |
-
<div id="smileyContainer" class="absolute top-0 left-0 w-full h-full overflow-hidden"></div>
|
| 60 |
</div>
|
| 61 |
</div>
|
| 62 |
|
|
@@ -180,7 +181,7 @@
|
|
| 180 |
suggestionText.textContent = positiveSuggestions[dominantEmotion];
|
| 181 |
factText.textContent = emotionFacts[dominantEmotion];
|
| 182 |
}
|
| 183 |
-
},
|
| 184 |
}
|
| 185 |
|
| 186 |
|
|
@@ -194,12 +195,8 @@
|
|
| 194 |
|
| 195 |
// Create falling smileys
|
| 196 |
function createFallingSmileys(emotion) {
|
| 197 |
-
const container = document.getElementById('smileyContainer');
|
| 198 |
-
container.innerHTML = ''; // Clear previous smileys
|
| 199 |
-
|
| 200 |
const emoji = emotionEmojis[emotion];
|
| 201 |
-
const
|
| 202 |
-
const duration = Math.random() * 3 + 2; // Random duration between 2-5s
|
| 203 |
|
| 204 |
// Create multiple smileys
|
| 205 |
for (let i = 0; i < 15; i++) {
|
|
@@ -207,16 +204,22 @@
|
|
| 207 |
smiley.className = 'falling-smiley';
|
| 208 |
smiley.textContent = emoji;
|
| 209 |
|
| 210 |
-
// Random position across the
|
| 211 |
-
const left = Math.random() *
|
| 212 |
smiley.style.left = `${left}px`;
|
| 213 |
-
smiley.style.top = '
|
| 214 |
-
smiley.style.animationDuration = `${duration}s`;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 215 |
|
| 216 |
-
|
| 217 |
-
smiley.style.animationDelay = `${Math.random() * 2}s`;
|
| 218 |
|
| 219 |
-
|
|
|
|
|
|
|
|
|
|
| 220 |
}
|
| 221 |
}
|
| 222 |
|
|
|
|
| 30 |
to { opacity: 1; }
|
| 31 |
}
|
| 32 |
.falling-smiley {
|
| 33 |
+
position: fixed;
|
| 34 |
font-size: 2rem;
|
| 35 |
animation: fall linear forwards;
|
| 36 |
z-index: 10;
|
| 37 |
pointer-events: none;
|
| 38 |
+
opacity: 0.8;
|
| 39 |
}
|
| 40 |
@keyframes fall {
|
| 41 |
to {
|
| 42 |
transform: translateY(100vh);
|
| 43 |
+
opacity: 0;
|
| 44 |
}
|
| 45 |
}
|
| 46 |
</style>
|
|
|
|
| 58 |
<div class="relative aspect-video bg-gray-200 rounded-lg overflow-hidden mb-4">
|
| 59 |
<video id="video" width="100%" height="100%" autoplay muted class="object-cover"></video>
|
| 60 |
<canvas id="canvas" class="absolute top-0 left-0 w-full h-full pointer-events-none"></canvas>
|
|
|
|
| 61 |
</div>
|
| 62 |
</div>
|
| 63 |
|
|
|
|
| 181 |
suggestionText.textContent = positiveSuggestions[dominantEmotion];
|
| 182 |
factText.textContent = emotionFacts[dominantEmotion];
|
| 183 |
}
|
| 184 |
+
}, 2000); // Update every 4 seconds
|
| 185 |
}
|
| 186 |
|
| 187 |
|
|
|
|
| 195 |
|
| 196 |
// Create falling smileys
|
| 197 |
function createFallingSmileys(emotion) {
|
|
|
|
|
|
|
|
|
|
| 198 |
const emoji = emotionEmojis[emotion];
|
| 199 |
+
const duration = 8; // Slower falling
|
|
|
|
| 200 |
|
| 201 |
// Create multiple smileys
|
| 202 |
for (let i = 0; i < 15; i++) {
|
|
|
|
| 204 |
smiley.className = 'falling-smiley';
|
| 205 |
smiley.textContent = emoji;
|
| 206 |
|
| 207 |
+
// Random position across the whole screen width
|
| 208 |
+
const left = Math.random() * window.innerWidth;
|
| 209 |
smiley.style.left = `${left}px`;
|
| 210 |
+
smiley.style.top = '-50px'; // Start above the viewport
|
| 211 |
+
smiley.style.animationDuration = `${duration + Math.random() * 4}s`; // Varying speeds
|
| 212 |
+
|
| 213 |
+
// Random size variation
|
| 214 |
+
const size = 1 + Math.random();
|
| 215 |
+
smiley.style.fontSize = `${size}rem`;
|
| 216 |
|
| 217 |
+
document.body.appendChild(smiley);
|
|
|
|
| 218 |
|
| 219 |
+
// Remove smiley after animation completes
|
| 220 |
+
setTimeout(() => {
|
| 221 |
+
smiley.remove();
|
| 222 |
+
}, duration * 1000);
|
| 223 |
}
|
| 224 |
}
|
| 225 |
|