Spaces:
Running
Running
File size: 19,486 Bytes
779e0e3 | 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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cheese Moon Calculator</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
:root {
--cheese-yellow: #f9d56e;
--cheese-orange: #e47c5d;
--space-blue: #0c1445;
--moon-gray: #d9d9d9;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
background-color: var(--space-blue);
color: white;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
padding: 2rem;
background-image: radial-gradient(circle, #1a237e 0%, #0c1445 100%);
position: relative;
overflow-x: hidden;
}
body::before {
content: '';
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image:
radial-gradient(circle, white 1px, transparent 1px),
radial-gradient(circle, rgba(255,255,255,0.3) 1px, transparent 1px);
background-size: 30px 30px, 60px 60px;
z-index: -1;
animation: twinkle 15s linear infinite;
}
@keyframes twinkle {
0% { opacity: 0.2; }
50% { opacity: 0.8; }
100% { opacity: 0.2; }
}
header {
text-align: center;
margin-bottom: 2rem;
position: relative;
z-index: 2;
}
h1 {
font-size: 2.5rem;
margin-bottom: 0.5rem;
background: linear-gradient(90deg, var(--cheese-yellow), var(--cheese-orange));
-webkit-background-clip: text;
background-clip: text;
color: transparent;
text-shadow: 0 0 10px rgba(248, 212, 120, 0.3);
}
.tagline {
font-style: italic;
opacity: 0.8;
margin-bottom: 1rem;
font-size: 1.1rem;
}
.content-container {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
max-width: 1200px;
gap: 2rem;
}
.visual-display {
position: relative;
width: 300px;
height: 300px;
margin: 1rem auto;
}
.moon {
position: absolute;
width: 100%;
height: 100%;
border-radius: 50%;
background-color: var(--moon-gray);
box-shadow: 0 0 40px rgba(255, 255, 255, 0.3);
overflow: hidden;
transition: all 1s ease;
}
.moon-cheese {
position: absolute;
width: 100%;
height: 100%;
border-radius: 50%;
background-color: var(--cheese-yellow);
opacity: 0;
transition: all 1s ease;
background-image:
radial-gradient(circle, var(--cheese-orange) 10%, transparent 10%),
radial-gradient(circle, var(--cheese-orange) 10%, transparent 10%);
background-size: 50px 50px;
background-position: 0 0, 25px 25px;
}
.cheese-hole {
position: absolute;
border-radius: 50%;
background-color: transparent;
border: 2px dashed var(--cheese-orange);
animation: float 4s infinite ease-in-out;
}
@keyframes float {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-10px); }
}
.calculator {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
border-radius: 15px;
padding: 2rem;
width: 100%;
max-width: 600px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
border: 1px solid rgba(255, 255, 255, 0.1);
transition: transform 0.3s ease;
}
.calculator:hover {
transform: translateY(-5px);
}
.input-group {
margin-bottom: 1.5rem;
}
label {
display: block;
margin-bottom: 0.5rem;
font-weight: 500;
color: var(--cheese-yellow);
}
select, input {
width: 100%;
padding: 0.8rem;
border-radius: 8px;
border: none;
background: rgba(255, 255, 255, 0.9);
font-size: 1rem;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
button {
background: linear-gradient(45deg, var(--cheese-yellow), var(--cheese-orange));
color: var(--space-blue);
border: none;
padding: 1rem 2rem;
border-radius: 8px;
font-size: 1rem;
font-weight: bold;
cursor: pointer;
width: 100%;
margin-top: 1rem;
transition: all 0.3s ease;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
text-transform: uppercase;
letter-spacing: 1px;
}
button:hover {
transform: translateY(-2px);
box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
filter: brightness(1.1);
}
.result {
margin-top: 2rem;
padding: 1.5rem;
background: rgba(0, 0, 0, 0.3);
border-radius: 10px;
border-left: 4px solid var(--cheese-yellow);
animation: fadeIn 0.5s ease-in-out;
display: none;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.result h3 {
color: var(--cheese-yellow);
margin-bottom: 1rem;
display: flex;
align-items: center;
gap: 0.5rem;
}
.result-value {
font-size: 1.5rem;
font-weight: bold;
margin: 0.5rem 0;
color: white;
}
.comparison {
margin-top: 1rem;
font-style: italic;
opacity: 0.8;
}
.facts {
margin-top: 3rem;
width: 100%;
max-width: 800px;
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
border-radius: 15px;
padding: 2rem;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
.facts h2 {
color: var(--cheese-yellow);
margin-bottom: 1rem;
text-align: center;
}
.fact-list {
list-style-type: none;
}
.fact-item {
padding: 1rem 0;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
display: flex;
align-items: flex-start;
gap: 1rem;
}
.fact-item:last-child {
border-bottom: none;
}
.fact-icon {
color: var(--cheese-orange);
font-size: 1.2rem;
margin-top: 0.2rem;
}
footer {
margin-top: 3rem;
text-align: center;
opacity: 0.7;
font-size: 0.9rem;
}
/* Animation classes */
.show-cheese {
opacity: 1;
transform: scale(1.05);
}
.hide-moon {
opacity: 0;
transform: scale(0.9);
}
.generate-holes {
animation: holeGen 2s forwards;
pointer-events: none;
}
@keyframes holeGen {
to {
opacity: 1;
transform: scale(1.5) rotate(360deg);
}
}
/* Responsive design */
@media (min-width: 768px) {
.content-container {
flex-direction: row;
align-items: flex-start;
justify-content: center;
}
.visual-display {
width: 350px;
height: 350px;
}
h1 {
font-size: 3rem;
}
}
@media (min-width: 1024px) {
.visual-display {
width: 400px;
height: 400px;
}
}
</style>
</head>
<body>
<header>
<h1>Cheese Moon Calculator</h1>
<p class="tagline">Discover what would happen if the moon was made of Swiss cheese!</p>
</header>
<div class="content-container">
<div class="visual-display">
<div class="moon"></div>
<div class="moon-cheese"></div>
<!-- Cheese holes will be added by JS -->
</div>
<div class="calculator">
<div class="input-group">
<label for="cheese-type"><i class="fas fa-cheese"></i> Type of Swiss Cheese</label>
<select id="cheese-type">
<option value="young">Young Swiss Cheese (density: 0.93 g/cm³)</option>
<option value="aged" selected>Aged Swiss Cheese (density: 0.95 g/cm³)</option>
<option value="extra-aged">Extra Aged Swiss Cheese (density: 0.97 g/cm³)</option>
<option value="holey">Very Holey Swiss Cheese (density: 0.90 g/cm³)</option>
</select>
</div>
<div class="input-group">
<label for="hole-percentage"><i class="fas fa-circle"></i> Percentage of Holes in Cheese</label>
<input type="range" id="hole-percentage" min="1" max="30" value="15" step="1">
<span id="hole-value">15%</span>
</div>
<button id="calculate-btn"><i class="fas fa-calculator"></i> Calculate Cheese Moon Mass</button>
<div class="result" id="result">
<h3><i class="fas fa-moon"></i> Cheese Moon Results</h3>
<p>The mass of the moon if made with Swiss cheese would be approximately:</p>
<div class="result-value" id="cheese-mass">--</div>
<p class="comparison" id="comparison">
That's about <span id="percentage">--</span> of the real moon's mass!
</p>
</div>
</div>
</div>
<div class="facts">
<h2><i class="fas fa-info-circle"></i> Fun Facts About This Calculation</h2>
<ul class="fact-list">
<li class="fact-item">
<div class="fact-icon"><i class="fas fa-weight"></i></div>
<div>
<strong>Real Moon Mass:</strong> The actual moon has a mass of about 7.342×10²² kg, which is roughly 1.2% of Earth's mass.
</div>
</li>
<li class="fact-item">
<div class="fact-icon"><i class="fas fa-cheese"></i></div>
<div>
<strong>Swiss Cheese Density:</strong> The average density of Swiss cheese is about 0.95 g/cm³, compared to the moon's 3.34 g/cm³. That's why it would be much lighter!
</div>
</li>
<li class="fact-item">
<div class="fact-icon"><i class="fas fa-percentage"></i></div>
<div>
<strong>Hole Impact:</strong> The holes in Swiss cheese typically account for 10-20% of its volume. This affects the overall mass when scaled up to moon size.
</div>
</li>
<li class="fact-item">
<div class="fact-icon"><i class="fas fa-globe-europe"></i></div>
<div>
<strong>Tidal Effects:</strong> A cheese moon would have much weaker gravitational pull due to its lower mass, causing smaller ocean tides on Earth (only about 1/3 of current tides).
</div>
</li>
</ul>
</div>
<footer>
<p>Made with <i class="fas fa-heart" style="color: #e47c5d;"></i> by Cheese Moon Enthusiasts | Scientific data approximated for educational purposes</p>
</footer>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Constants
const REAL_MOON_MASS = 7.342e22; // kg
const REAL_MOON_VOLUME = 2.1968e19; // m³
const CHEESE_DENSITY = {
'young': 930, // kg/m³
'aged': 950,
'extra-aged': 970,
'holey': 900
};
// DOM elements
const holePercentageSlider = document.getElementById('hole-percentage');
const holeValueDisplay = document.getElementById('hole-value');
const cheeseTypeSelect = document.getElementById('cheese-type');
const calculateBtn = document.getElementById('calculate-btn');
const resultDiv = document.getElementById('result');
const cheeseMassDisplay = document.getElementById('cheese-mass');
const comparisonDisplay = document.getElementById('comparison');
const percentageDisplay = document.getElementById('percentage');
const moon = document.querySelector('.moon');
const moonCheese = document.querySelector('.moon-cheese');
const visualDisplay = document.querySelector('.visual-display');
// Update hole percentage display
holePercentageSlider.addEventListener('input', function() {
holeValueDisplay.textContent = `${this.value}%`;
// Trigger visual update
updateCheeseHoles(parseInt(this.value));
});
// Calculate button click handler
calculateBtn.addEventListener('click', function() {
calculateCheeseMoonMass();
});
// Cheese type change handler
cheeseTypeSelect.addEventListener('change', function() {
// Update visuals when cheese type changes
setTimeout(() => {
updateCheeseHoles(parseInt(holePercentageSlider.value));
}, 300);
});
// Function to calculate cheese moon mass
function calculateCheeseMoonMass() {
const cheeseType = cheeseTypeSelect.value;
const holePercentage = parseInt(holePercentageSlider.value);
// Calculate effective density (accounting for holes)
const baseDensity = CHEESE_DENSITY[cheeseType];
const effectiveDensity = baseDensity * (1 - holePercentage/100);
// Calculate mass (mass = density × volume)
const cheeseMoonMass = REAL_MOON_VOLUME * effectiveDensity;
// Format the mass for display
const formattedMass = formatMass(cheeseMoonMass);
// Calculate percentage of real moon mass
const percentage = (cheeseMoonMass / REAL_MOON_MASS * 100).toFixed(2);
// Update the display
cheeseMassDisplay.textContent = formattedMass;
percentageDisplay.textContent = `${percentage}%`;
// Show the result with animation
resultDiv.style.display = 'block';
resultDiv.style.animation = 'none';
void resultDiv.offsetWidth; // Trigger reflow
resultDiv.style.animation = 'fadeIn 0.5s ease-in-out';
// Animate the moon transformation
animateMoonTransformation();
}
// Format mass for display
function formatMass(massKg) {
if (massKg >= 1e21) {
return (massKg / 1e21).toFixed(2) + ' × 10²¹ kg';
}
return massKg.toExponential(2) + ' kg';
}
// Animate the moon transformation
function animateMoonTransformation() {
// Hide regular moon
moon.classList.add('hide-moon');
// Show cheese moon
setTimeout(() => {
moonCheese.classList.add('show-cheese');
}, 300);
// Generate cheese holes
updateCheeseHoles(parseInt(holePercentageSlider.value));
}
// Update cheese holes visualization
function updateCheeseHoles(percentage) {
// Clear existing holes
const existingHoles = document.querySelectorAll('.cheese-hole');
existingHoles.forEach(hole => hole.remove());
const holeCount = Math.floor(percentage * 2); // More holes for higher percentage
for (let i = 0; i < holeCount; i++) {
const hole = document.createElement('div');
hole.className = 'cheese-hole';
// Random size (3-8% of moon diameter)
const size = Math.random() * 5 + 3;
hole.style.width = `${size}%`;
hole.style.height = `${size}%`;
// Random position
const angle = Math.random() * 2 * Math.PI;
const distance = Math.random() * 40 + 5; // 5-45% from center
const x = 50 + distance * Math.cos(angle) - size/2;
const y = 50 + distance * Math.sin(angle) - size/2;
hole.style.left = `${x}%`;
hole.style.top = `${y}%`;
// Random animation delay
hole.style.animationDelay = `${Math.random() * 2}s`;
visualDisplay.appendChild(hole);
}
}
// Initialize with some holes
updateCheeseHoles(parseInt(holePercentageSlider.value));
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <a href="https://enzostvs-deepsite.hf.space" style="color: #fff;" target="_blank" >DeepSite</a> <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;"></p></body>
</html> |