Spaces:
Running
DESENVOLVA O SEGUINTE JOGO: 🌊 Jogo: “Pedrinhas na Água”
Browse filesObjetivo:
Simular o ato de jogar pedrinhas num lago, trazendo calma, ritmo e distração suave.
Como funciona:
Tela inicial: aparece um lago calmo, com reflexo do céu.
Interatividade:
A pessoa arrasta o dedo na tela e solta → uma pedrinha cai na água.
Cada toque gera ondas circulares suaves e um som de água relaxante.
Recompensa visual:
Quanto mais pedrinhas joga, mais ondas se sobrepõem de forma hipnótica.
Às vezes surgem peixinhos ou flores de lótus boiando, como surpresa positiva.
Ritmo calmante:
O jogo incentiva a jogar pedrinhas devagar, criando padrões de ondas que lembram meditação.
Pode ter um “modo zen” em que a tela automaticamente gera ondas suaves, só para observar.
Por que funciona?
A ação repetitiva de arrastar e soltar dá sensação de controle.
O som da água e os círculos que se expandem ajudam a regular o foco da mente.
É simples, intuitivo e traz aquela nostalgia de jogar pedrinhas de verdade.
- README.md +8 -5
- index.html +588 -18
|
@@ -1,10 +1,13 @@
|
|
| 1 |
---
|
| 2 |
-
title: Serene Pebble Pond
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Serene Pebble Pond 🌊
|
| 3 |
+
colorFrom: purple
|
| 4 |
+
colorTo: green
|
| 5 |
+
emoji: 🐳
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite-v3
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Welcome to your new DeepSite project!
|
| 13 |
+
This project was created with [DeepSite](https://deepsite.hf.co).
|
|
@@ -1,19 +1,589 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</html>
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="pt-br">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Serene Pebble Pond</title>
|
| 7 |
+
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
|
| 8 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 10 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 11 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.7.0/p5.min.js"></script>
|
| 12 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.7.0/addons/p5.sound.min.js"></script>
|
| 13 |
+
<style>
|
| 14 |
+
body, html {
|
| 15 |
+
margin: 0;
|
| 16 |
+
padding: 0;
|
| 17 |
+
overflow: hidden;
|
| 18 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
| 19 |
+
}
|
| 20 |
+
#defaultCanvas0 {
|
| 21 |
+
position: absolute;
|
| 22 |
+
top: 0;
|
| 23 |
+
left: 0;
|
| 24 |
+
z-index: 1;
|
| 25 |
+
}
|
| 26 |
+
.ui-overlay {
|
| 27 |
+
position: absolute;
|
| 28 |
+
z-index: 10;
|
| 29 |
+
pointer-events: none;
|
| 30 |
+
width: 100%;
|
| 31 |
+
height: 100%;
|
| 32 |
+
}
|
| 33 |
+
.ui-element {
|
| 34 |
+
pointer-events: auto;
|
| 35 |
+
}
|
| 36 |
+
.ripple {
|
| 37 |
+
position: absolute;
|
| 38 |
+
border-radius: 50%;
|
| 39 |
+
border: 2px solid rgba(255, 255, 255, 0.6);
|
| 40 |
+
transform: translate(-50%, -50%);
|
| 41 |
+
pointer-events: none;
|
| 42 |
+
}
|
| 43 |
+
@keyframes fadeIn {
|
| 44 |
+
from { opacity: 0; transform: translateY(10px); }
|
| 45 |
+
to { opacity: 1; transform: translateY(0); }
|
| 46 |
+
}
|
| 47 |
+
.fade-in {
|
| 48 |
+
animation: fadeIn 0.8s ease-out forwards;
|
| 49 |
+
}
|
| 50 |
+
</style>
|
| 51 |
+
</head>
|
| 52 |
+
<body class="bg-gradient-to-br from-blue-50 to-green-50 flex items-center justify-center min-h-screen">
|
| 53 |
+
<!-- Main Canvas for the Pond -->
|
| 54 |
+
<div id="canvas-container" class="w-full h-full absolute"></div>
|
| 55 |
+
|
| 56 |
+
<!-- UI Overlay -->
|
| 57 |
+
<div class="ui-overlay flex flex-col items-center justify-between p-6">
|
| 58 |
+
<!-- Top Bar -->
|
| 59 |
+
<div class="w-full flex justify-between items-center fade-in">
|
| 60 |
+
<h1 class="text-3xl font-light text-slate-700 drop-shadow-lg">Serene Pebble Pond</h1>
|
| 61 |
+
<div class="flex space-x-4">
|
| 62 |
+
<button id="zenToggle" class="ui-element bg-white/30 backdrop-blur-sm text-slate-700 px-4 py-2 rounded-full shadow-lg hover:bg-white/50 transition-all duration-300 flex items-center space-x-2">
|
| 63 |
+
<i data-feather="moon"></i>
|
| 64 |
+
<span id="zenText">Modo Zen: OFF</span>
|
| 65 |
+
</button>
|
| 66 |
+
<button id="infoBtn" class="ui-element bg-white/30 backdrop-blur-sm text-slate-700 w-10 h-10 rounded-full shadow-lg hover:bg-white/50 transition-all duration-300 flex items-center justify-center">
|
| 67 |
+
<i data-feather="info"></i>
|
| 68 |
+
</button>
|
| 69 |
+
</div>
|
| 70 |
+
</div>
|
| 71 |
+
|
| 72 |
+
<!-- Center Instructions -->
|
| 73 |
+
<div id="instructions" class="text-center bg-black/20 backdrop-blur-sm text-white p-4 rounded-lg shadow-xl fade-in">
|
| 74 |
+
<p class="text-lg mb-2">Arraste e solte para lançar uma pedrinha</p>
|
| 75 |
+
<p class="text-sm opacity-80">Força e direção controlam o arremesso</p>
|
| 76 |
+
</div>
|
| 77 |
+
|
| 78 |
+
<!-- Bottom Stats -->
|
| 79 |
+
<div class="w-full flex justify-between items-end fade-in">
|
| 80 |
+
<div class="bg-white/30 backdrop-blur-sm text-slate-700 px-4 py-2 rounded-lg shadow-lg">
|
| 81 |
+
<p class="text-sm">Pedras lançadas: <span id="pebbleCount">0</span></p>
|
| 82 |
+
</div>
|
| 83 |
+
<div class="text-slate-700 text-sm bg-white/30 backdrop-blur-sm px-4 py-2 rounded-lg shadow-lg">
|
| 84 |
+
<p>Respire. Relaxe. Aproveite o momento.</p>
|
| 85 |
+
</div>
|
| 86 |
+
</div>
|
| 87 |
+
</div>
|
| 88 |
+
|
| 89 |
+
<!-- Info Modal -->
|
| 90 |
+
<div id="infoModal" class="fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-20 hidden">
|
| 91 |
+
<div class="bg-white rounded-xl shadow-2xl p-6 max-w-md mx-4 fade-in">
|
| 92 |
+
<div class="flex justify-between items-center mb-4">
|
| 93 |
+
<h2 class="text-2xl font-light text-slate-700">Sobre o Jogo</h2>
|
| 94 |
+
<button id="closeModal" class="text-slate-500 hover:text-slate-700">
|
| 95 |
+
<i data-feather="x"></i>
|
| 96 |
+
</button>
|
| 97 |
+
</div>
|
| 98 |
+
<p class="text-slate-600 mb-4">
|
| 99 |
+
Serene Pebble Pond é uma experiência interativa projetada para promover calma e relaxamento. Simule o ato nostálgico de jogar pedrinhas num lago tranquilo.
|
| 100 |
+
</p>
|
| 101 |
+
<ul class="text-slate-600 space-y-2 mb-4">
|
| 102 |
+
<li class="flex items-start">
|
| 103 |
+
<i data-feather="check-circle" class="text-green-500 mr-2 mt-1 flex-shrink-0"></i>
|
| 104 |
+
<span>Arraste e solte para lançar pedras</span>
|
| 105 |
+
</li>
|
| 106 |
+
<li class="flex items-start">
|
| 107 |
+
<i data-feather="check-circle" class="text-green-500 mr-2 mt-1 flex-shrink-0"></i>
|
| 108 |
+
<span>Observe as ondas hipnóticas se espalharem</span>
|
| 109 |
+
</li>
|
| 110 |
+
<li class="flex items-start">
|
| 111 |
+
<i data-feather="check-circle" class="text-green-500 mr-2 mt-1 flex-shrink-0"></i>
|
| 112 |
+
<span>Ative o Modo Zen para relaxamento automático</span>
|
| 113 |
+
</li>
|
| 114 |
+
</ul>
|
| 115 |
+
<p class="text-sm text-slate-500">Encontre sua paz. 🌿</p>
|
| 116 |
+
</div>
|
| 117 |
+
</div>
|
| 118 |
+
|
| 119 |
+
<!-- Custom Ripple Container -->
|
| 120 |
+
<div id="ripple-container"></div>
|
| 121 |
+
|
| 122 |
+
<script>
|
| 123 |
+
// Tailwind Config for custom colors
|
| 124 |
+
tailwind.config = {
|
| 125 |
+
theme: {
|
| 126 |
+
extend: {
|
| 127 |
+
colors: {
|
| 128 |
+
'water-blue': '#88C1D0',
|
| 129 |
+
'deep-blue': '#4A6FA5',
|
| 130 |
+
'leaf-green': '#87A96B',
|
| 131 |
+
'lotus-pink': '#E6B8B8',
|
| 132 |
+
'fish-orange': '#FF9A76'
|
| 133 |
+
}
|
| 134 |
+
}
|
| 135 |
+
}
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
// p5.js Sketch
|
| 139 |
+
let pond;
|
| 140 |
+
let pebbles = [];
|
| 141 |
+
let ripples = [];
|
| 142 |
+
let fishes = [];
|
| 143 |
+
let lotuses = [];
|
| 144 |
+
let zenMode = false;
|
| 145 |
+
let zenInterval;
|
| 146 |
+
let pebbleCount = 0;
|
| 147 |
+
let dragStart = null;
|
| 148 |
+
let dragVector = null;
|
| 149 |
+
let splashSound;
|
| 150 |
+
let ambientSound;
|
| 151 |
+
|
| 152 |
+
function preload() {
|
| 153 |
+
// In a real scenario, you would load actual sound files
|
| 154 |
+
// splashSound = loadSound('splash.wav');
|
| 155 |
+
// ambientSound = loadSound('ambient.mp3');
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
function setup() {
|
| 159 |
+
let canvas = createCanvas(windowWidth, windowHeight);
|
| 160 |
+
canvas.parent('canvas-container');
|
| 161 |
+
frameRate(60);
|
| 162 |
+
|
| 163 |
+
// Create initial pond background
|
| 164 |
+
drawPondBackground();
|
| 165 |
+
|
| 166 |
+
// Start ambient sound in a real implementation
|
| 167 |
+
// if (ambientSound) {
|
| 168 |
+
// ambientSound.loop();
|
| 169 |
+
// ambientSound.setVolume(0.3);
|
| 170 |
+
// }
|
| 171 |
+
|
| 172 |
+
// Add some initial decorative elements
|
| 173 |
+
for (let i = 0; i < 3; i++) {
|
| 174 |
+
addRandomFish();
|
| 175 |
+
addRandomLotus();
|
| 176 |
+
}
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
function drawPondBackground() {
|
| 180 |
+
// Gradient background for sky and water
|
| 181 |
+
drawingContext.save();
|
| 182 |
+
let gradient = drawingContext.createLinearGradient(0, 0, 0, height);
|
| 183 |
+
gradient.addColorStop(0, '#E0F7FA'); // Light sky blue
|
| 184 |
+
gradient.addColorStop(0.6, '#B3E5FC'); // Medium sky blue
|
| 185 |
+
gradient.addColorStop(0.61, '#4FC3F7'); // Water surface
|
| 186 |
+
gradient.addColorStop(1, '#0288D1'); // Deep water
|
| 187 |
+
drawingContext.fillStyle = gradient;
|
| 188 |
+
drawingContext.fillRect(0, 0, width, height);
|
| 189 |
+
drawingContext.restore();
|
| 190 |
+
|
| 191 |
+
// Add some subtle water texture
|
| 192 |
+
drawingContext.save();
|
| 193 |
+
drawingContext.globalAlpha = 0.1;
|
| 194 |
+
for (let i = 0; i < 100; i++) {
|
| 195 |
+
let x = random(width);
|
| 196 |
+
let y = random(height * 0.6, height);
|
| 197 |
+
let size = random(2, 5);
|
| 198 |
+
drawingContext.fillStyle = '#FFFFFF';
|
| 199 |
+
drawingContext.fillRect(x, y, size, size/3);
|
| 200 |
+
}
|
| 201 |
+
drawingContext.restore();
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
function draw() {
|
| 205 |
+
// Clear with semi-transparent for trail effect
|
| 206 |
+
drawingContext.save();
|
| 207 |
+
drawingContext.globalCompositeOperation = 'source-over';
|
| 208 |
+
drawingContext.fillStyle = 'rgba(255, 255, 255, 0.05)';
|
| 209 |
+
drawingContext.fillRect(0, 0, width, height);
|
| 210 |
+
drawingContext.restore();
|
| 211 |
+
|
| 212 |
+
// Redraw pond background (water area)
|
| 213 |
+
drawingContext.save();
|
| 214 |
+
let gradient = drawingContext.createLinearGradient(0, height * 0.6, 0, height);
|
| 215 |
+
gradient.addColorStop(0, '#4FC3F7');
|
| 216 |
+
gradient.addColorStop(1, '#0288D1');
|
| 217 |
+
drawingContext.fillStyle = gradient;
|
| 218 |
+
drawingContext.fillRect(0, height * 0.6, width, height * 0.4);
|
| 219 |
+
drawingContext.restore();
|
| 220 |
+
|
| 221 |
+
// Update and draw pebbles
|
| 222 |
+
for (let i = pebbles.length - 1; i >= 0; i--) {
|
| 223 |
+
pebbles[i].update();
|
| 224 |
+
pebbles[i].display();
|
| 225 |
+
if (pebbles[i].shouldRemove()) {
|
| 226 |
+
pebbles.splice(i, 1);
|
| 227 |
+
}
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
// Update and draw ripples
|
| 231 |
+
for (let i = ripples.length - 1; i >= 0; i--) {
|
| 232 |
+
ripples[i].update();
|
| 233 |
+
ripples[i].display();
|
| 234 |
+
if (ripples[i].shouldRemove()) {
|
| 235 |
+
ripples.splice(i, 1);
|
| 236 |
+
}
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
// Update and draw fishes
|
| 240 |
+
for (let fish of fishes) {
|
| 241 |
+
fish.update();
|
| 242 |
+
fish.display();
|
| 243 |
+
}
|
| 244 |
+
|
| 245 |
+
// Draw lotuses
|
| 246 |
+
for (let lotus of lotuses) {
|
| 247 |
+
lotus.display();
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
// Draw drag vector if dragging
|
| 251 |
+
if (dragVector) {
|
| 252 |
+
drawDragVector();
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
// Zen mode automatic ripples
|
| 256 |
+
if (zenMode && frameCount % 120 === 0) {
|
| 257 |
+
createZenRipple();
|
| 258 |
+
}
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
function mousePressed() {
|
| 262 |
+
if (mouseY > height * 0.6) { // Only in water area
|
| 263 |
+
dragStart = createVector(mouseX, mouseY);
|
| 264 |
+
}
|
| 265 |
+
return false;
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
function mouseDragged() {
|
| 269 |
+
if (dragStart) {
|
| 270 |
+
dragVector = createVector(mouseX - dragStart.x, mouseY - dragStart.y);
|
| 271 |
+
// Limit vector length for better control
|
| 272 |
+
dragVector.limit(150);
|
| 273 |
+
}
|
| 274 |
+
return false;
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
function mouseReleased() {
|
| 278 |
+
if (dragStart && dragVector) {
|
| 279 |
+
throwPebble(dragStart.x, dragStart.y, dragVector);
|
| 280 |
+
dragStart = null;
|
| 281 |
+
dragVector = null;
|
| 282 |
+
}
|
| 283 |
+
return false;
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
function throwPebble(x, y, vector) {
|
| 287 |
+
// Create pebble
|
| 288 |
+
let pebble = new Pebble(x, y, vector);
|
| 289 |
+
pebbles.push(pebble);
|
| 290 |
+
pebbleCount++;
|
| 291 |
+
document.getElementById('pebbleCount').textContent = pebbleCount;
|
| 292 |
+
|
| 293 |
+
// Play splash sound in real implementation
|
| 294 |
+
// if (splashSound) {
|
| 295 |
+
// splashSound.play();
|
| 296 |
+
// splashSound.setVolume(map(vector.mag(), 0, 150, 0.3, 1.0));
|
| 297 |
+
// }
|
| 298 |
+
|
| 299 |
+
// Chance to spawn surprise elements
|
| 300 |
+
if (random() < 0.15) {
|
| 301 |
+
if (random() < 0.5) {
|
| 302 |
+
addRandomFish();
|
| 303 |
+
} else {
|
| 304 |
+
addRandomLotus();
|
| 305 |
+
}
|
| 306 |
+
}
|
| 307 |
+
}
|
| 308 |
+
|
| 309 |
+
function drawDragVector() {
|
| 310 |
+
drawingContext.save();
|
| 311 |
+
drawingContext.strokeStyle = 'rgba(255, 255, 255, 0.8)';
|
| 312 |
+
drawingContext.lineWidth = 2;
|
| 313 |
+
drawingContext.setLineDash([5, 5]);
|
| 314 |
+
drawingContext.beginPath();
|
| 315 |
+
drawingContext.moveTo(dragStart.x, dragStart.y);
|
| 316 |
+
drawingContext.lineTo(dragStart.x + dragVector.x, dragStart.y + dragVector.y);
|
| 317 |
+
drawingContext.stroke();
|
| 318 |
+
|
| 319 |
+
// Draw arrow head
|
| 320 |
+
drawingContext.fillStyle = 'rgba(255, 255, 255, 0.8)';
|
| 321 |
+
drawingContext.beginPath();
|
| 322 |
+
drawingContext.translate(dragStart.x + dragVector.x, dragStart.y + dragVector.y);
|
| 323 |
+
drawingContext.rotate(dragVector.heading());
|
| 324 |
+
drawingContext.moveTo(0, 0);
|
| 325 |
+
drawingContext.lineTo(-10, -5);
|
| 326 |
+
drawingContext.lineTo(-10, 5);
|
| 327 |
+
drawingContext.closePath();
|
| 328 |
+
drawingContext.fill();
|
| 329 |
+
drawingContext.restore();
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
function createZenRipple() {
|
| 333 |
+
let x = random(width * 0.2, width * 0.8);
|
| 334 |
+
let y = random(height * 0.7, height * 0.9);
|
| 335 |
+
let ripple = new Ripple(x, y, random(5, 15));
|
| 336 |
+
ripples.push(ripple);
|
| 337 |
+
}
|
| 338 |
+
|
| 339 |
+
function addRandomFish() {
|
| 340 |
+
if (fishes.length < 8) { // Limit number of fishes
|
| 341 |
+
let fish = new Fish();
|
| 342 |
+
fishes.push(fish);
|
| 343 |
+
}
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
function addRandomLotus() {
|
| 347 |
+
if (lotuses.length < 5) { // Limit number of lotuses
|
| 348 |
+
let lotus = new Lotus();
|
| 349 |
+
lotuses.push(lotus);
|
| 350 |
+
}
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
function windowResized() {
|
| 354 |
+
resizeCanvas(windowWidth, windowHeight);
|
| 355 |
+
drawPondBackground();
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
// Pebble Class
|
| 359 |
+
class Pebble {
|
| 360 |
+
constructor(x, y, velocity) {
|
| 361 |
+
this.pos = createVector(x, y);
|
| 362 |
+
this.vel = velocity.copy().mult(0.2); // Scale down velocity
|
| 363 |
+
this.acc = createVector(0, 0.3); // Gravity
|
| 364 |
+
this.size = random(8, 15);
|
| 365 |
+
this.color = [random(180, 220), random(180, 220), random(180, 220)];
|
| 366 |
+
this.splashCreated = false;
|
| 367 |
+
}
|
| 368 |
+
|
| 369 |
+
update() {
|
| 370 |
+
this.vel.add(this.acc);
|
| 371 |
+
this.pos.add(this.vel);
|
| 372 |
+
|
| 373 |
+
// Check if hit water surface
|
| 374 |
+
if (!this.splashCreated && this.pos.y > height * 0.6) {
|
| 375 |
+
this.createSplash();
|
| 376 |
+
this.splashCreated = true;
|
| 377 |
+
}
|
| 378 |
+
}
|
| 379 |
+
|
| 380 |
+
display() {
|
| 381 |
+
drawingContext.save();
|
| 382 |
+
drawingContext.fillStyle = `rgb(${this.color[0]}, ${this.color[1]}, ${this.color[2]})`;
|
| 383 |
+
drawingContext.beginPath();
|
| 384 |
+
drawingContext.arc(this.pos.x, this.pos.y, this.size, 0, TWO_PI);
|
| 385 |
+
drawingContext.fill();
|
| 386 |
+
drawingContext.restore();
|
| 387 |
+
}
|
| 388 |
+
|
| 389 |
+
createSplash() {
|
| 390 |
+
let ripple = new Ripple(this.pos.x, this.pos.y, this.vel.mag() * 0.5);
|
| 391 |
+
ripples.push(ripple);
|
| 392 |
+
|
| 393 |
+
// Create HTML ripple effect
|
| 394 |
+
createHTMLRipple(this.pos.x, this.pos.y);
|
| 395 |
+
}
|
| 396 |
+
|
| 397 |
+
shouldRemove() {
|
| 398 |
+
return this.pos.y > height + 50;
|
| 399 |
+
}
|
| 400 |
+
}
|
| 401 |
+
|
| 402 |
+
// Ripple Class
|
| 403 |
+
class Ripple {
|
| 404 |
+
constructor(x, y, strength) {
|
| 405 |
+
this.x = x;
|
| 406 |
+
this.y = y;
|
| 407 |
+
this.radius = 5;
|
| 408 |
+
this.maxRadius = strength * 15 + 50;
|
| 409 |
+
this.speed = map(strength, 0, 75, 1, 3);
|
| 410 |
+
this.alpha = 1;
|
| 411 |
+
this.color = [255, 255, 255];
|
| 412 |
+
}
|
| 413 |
+
|
| 414 |
+
update() {
|
| 415 |
+
this.radius += this.speed;
|
| 416 |
+
this.alpha = 1 - (this.radius / this.maxRadius);
|
| 417 |
+
}
|
| 418 |
+
|
| 419 |
+
display() {
|
| 420 |
+
if (this.alpha <= 0) return;
|
| 421 |
+
|
| 422 |
+
drawingContext.save();
|
| 423 |
+
drawingContext.strokeStyle = `rgba(255, 255, 255, ${this.alpha * 0.6})`;
|
| 424 |
+
drawingContext.lineWidth = 2;
|
| 425 |
+
drawingContext.beginPath();
|
| 426 |
+
drawingContext.arc(this.x, this.y, this.radius, 0, TWO_PI);
|
| 427 |
+
drawingContext.stroke();
|
| 428 |
+
drawingContext.restore();
|
| 429 |
+
}
|
| 430 |
+
|
| 431 |
+
shouldRemove() {
|
| 432 |
+
return this.radius >= this.maxRadius;
|
| 433 |
+
}
|
| 434 |
+
}
|
| 435 |
+
|
| 436 |
+
// Fish Class
|
| 437 |
+
class Fish {
|
| 438 |
+
constructor() {
|
| 439 |
+
this.x = random(width);
|
| 440 |
+
this.y = random(height * 0.7, height * 0.95);
|
| 441 |
+
this.speed = random(0.5, 2);
|
| 442 |
+
this.direction = random() < 0.5 ? 1 : -1;
|
| 443 |
+
this.size = random(15, 25);
|
| 444 |
+
this.wiggle = 0;
|
| 445 |
+
this.wiggleSpeed = random(0.1, 0.3);
|
| 446 |
+
this.color = [255, random(100, 150), random(50, 100)]; // Orange tones
|
| 447 |
+
}
|
| 448 |
+
|
| 449 |
+
update() {
|
| 450 |
+
this.x += this.speed * this.direction;
|
| 451 |
+
this.wiggle += this.wiggleSpeed;
|
| 452 |
+
|
| 453 |
+
// Reverse direction at edges
|
| 454 |
+
if (this.x < -50 || this.x > width + 50) {
|
| 455 |
+
this.direction *= -1;
|
| 456 |
+
}
|
| 457 |
+
}
|
| 458 |
+
|
| 459 |
+
display() {
|
| 460 |
+
drawingContext.save();
|
| 461 |
+
drawingContext.translate(this.x, this.y + sin(this.wiggle) * 3);
|
| 462 |
+
drawingContext.scale(this.direction, 1);
|
| 463 |
+
|
| 464 |
+
// Fish body
|
| 465 |
+
drawingContext.fillStyle = `rgb(${this.color[0]}, ${this.color[1]}, ${this.color[2]})`;
|
| 466 |
+
drawingContext.beginPath();
|
| 467 |
+
drawingContext.ellipse(0, 0, this.size, this.size/2, 0, 0, TWO_PI);
|
| 468 |
+
drawingContext.fill();
|
| 469 |
+
|
| 470 |
+
// Tail
|
| 471 |
+
drawingContext.beginPath();
|
| 472 |
+
drawingContext.moveTo(-this.size, 0);
|
| 473 |
+
drawingContext.lineTo(-this.size - 10, -this.size/2);
|
| 474 |
+
drawingContext.lineTo(-this.size - 10, this.size/2);
|
| 475 |
+
drawingContext.closePath();
|
| 476 |
+
drawingContext.fill();
|
| 477 |
+
|
| 478 |
+
// Eye
|
| 479 |
+
drawingContext.fillStyle = 'white';
|
| 480 |
+
drawingContext.beginPath();
|
| 481 |
+
drawingContext.arc(this.size * 0.6, -this.size/4, this.size/5, 0, TWO_PI);
|
| 482 |
+
drawingContext.fill();
|
| 483 |
+
|
| 484 |
+
drawingContext.fillStyle = 'black';
|
| 485 |
+
drawingContext.beginPath();
|
| 486 |
+
drawingContext.arc(this.size * 0.6, -this.size/4, this.size/10, 0, TWO_PI);
|
| 487 |
+
drawingContext.fill();
|
| 488 |
+
|
| 489 |
+
drawingContext.restore();
|
| 490 |
+
}
|
| 491 |
+
}
|
| 492 |
+
|
| 493 |
+
// Lotus Class
|
| 494 |
+
class Lotus {
|
| 495 |
+
constructor() {
|
| 496 |
+
this.x = random(width * 0.1, width * 0.9);
|
| 497 |
+
this.y = random(height * 0.7, height * 0.9);
|
| 498 |
+
this.size = random(30, 50);
|
| 499 |
+
this.petalCount = int(random(5, 8));
|
| 500 |
+
this.color = [random(200, 255), random(150, 200), random(150, 200)]; // Pink tones
|
| 501 |
+
this.wobble = random(TWO_PI);
|
| 502 |
+
}
|
| 503 |
+
|
| 504 |
+
display() {
|
| 505 |
+
drawingContext.save();
|
| 506 |
+
drawingContext.translate(this.x, this.y + sin(this.wobble) * 2);
|
| 507 |
+
this.wobble += 0.02;
|
| 508 |
+
|
| 509 |
+
// Lotus petals
|
| 510 |
+
drawingContext.fillStyle = `rgb(${this.color[0]}, ${this.color[1]}, ${this.color[2]})`;
|
| 511 |
+
for (let i = 0; i < this.petalCount; i++) {
|
| 512 |
+
drawingContext.save();
|
| 513 |
+
drawingContext.rotate(i * TWO_PI / this.petalCount);
|
| 514 |
+
drawingContext.beginPath();
|
| 515 |
+
drawingContext.ellipse(this.size * 0.6, 0, this.size * 0.8, this.size * 0.4, 0, 0, TWO_PI);
|
| 516 |
+
drawingContext.fill();
|
| 517 |
+
drawingContext.restore();
|
| 518 |
+
}
|
| 519 |
+
|
| 520 |
+
// Center
|
| 521 |
+
drawingContext.fillStyle = `rgb(${this.color[0] - 50}, ${this.color[1] - 50}, ${this.color[2] - 50})`;
|
| 522 |
+
drawingContext.beginPath();
|
| 523 |
+
drawingContext.arc(0, 0, this.size * 0.3, 0, TWO_PI);
|
| 524 |
+
drawingContext.fill();
|
| 525 |
+
|
| 526 |
+
drawingContext.restore();
|
| 527 |
+
}
|
| 528 |
+
}
|
| 529 |
+
|
| 530 |
+
// HTML Ripple Effect
|
| 531 |
+
function createHTMLRipple(x, y) {
|
| 532 |
+
const ripple = document.createElement('div');
|
| 533 |
+
ripple.className = 'ripple';
|
| 534 |
+
ripple.style.left = x + 'px';
|
| 535 |
+
ripple.style.top = y + 'px';
|
| 536 |
+
ripple.style.width = '0px';
|
| 537 |
+
ripple.style.height = '0px';
|
| 538 |
+
|
| 539 |
+
document.getElementById('ripple-container').appendChild(ripple);
|
| 540 |
+
|
| 541 |
+
setTimeout(() => {
|
| 542 |
+
ripple.style.transition = 'all 1s ease-out';
|
| 543 |
+
ripple.style.width = '100px';
|
| 544 |
+
ripple.style.height = '100px';
|
| 545 |
+
ripple.style.opacity = '0';
|
| 546 |
+
}, 10);
|
| 547 |
+
|
| 548 |
+
setTimeout(() => {
|
| 549 |
+
ripple.remove();
|
| 550 |
+
}, 1100);
|
| 551 |
+
}
|
| 552 |
+
|
| 553 |
+
// UI Event Listeners
|
| 554 |
+
document.getElementById('zenToggle').addEventListener('click', function() {
|
| 555 |
+
zenMode = !zenMode;
|
| 556 |
+
const zenText = document.getElementById('zenText');
|
| 557 |
+
const icon = this.querySelector('i');
|
| 558 |
+
|
| 559 |
+
if (zenMode) {
|
| 560 |
+
zenText.textContent = 'Modo Zen: ON';
|
| 561 |
+
this.classList.add('bg-green-200/50');
|
| 562 |
+
feather.icons['sun'].replace(icon);
|
| 563 |
+
} else {
|
| 564 |
+
zenText.textContent = 'Modo Zen: OFF';
|
| 565 |
+
this.classList.remove('bg-green-200/50');
|
| 566 |
+
feather.icons['moon'].replace(icon);
|
| 567 |
+
}
|
| 568 |
+
});
|
| 569 |
+
|
| 570 |
+
document.getElementById('infoBtn').addEventListener('click', function() {
|
| 571 |
+
document.getElementById('infoModal').classList.remove('hidden');
|
| 572 |
+
});
|
| 573 |
+
|
| 574 |
+
document.getElementById('closeModal').addEventListener('click', function() {
|
| 575 |
+
document.getElementById('infoModal').classList.add('hidden');
|
| 576 |
+
});
|
| 577 |
+
|
| 578 |
+
// Close modal on background click
|
| 579 |
+
document.getElementById('infoModal').addEventListener('click', function(e) {
|
| 580 |
+
if (e.target === this) {
|
| 581 |
+
this.classList.add('hidden');
|
| 582 |
+
}
|
| 583 |
+
});
|
| 584 |
+
|
| 585 |
+
// Initialize feather icons
|
| 586 |
+
feather.replace();
|
| 587 |
+
</script>
|
| 588 |
+
</body>
|
| 589 |
</html>
|