commit 364fd46e43d4cfe72dd043b42fa2fe39925b873e
Author: root <root@hub.scroll.pub> Date: 2024-12-24 01:20:09 +0000 Subject: Initial commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..e37c367 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# spinwheel.scroll.pub +Website generated from prompt: make a wheel of fortune game \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..9a49a48 --- /dev/null +++ b/index.html @@ -0,0 +1,48 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <meta name="description" content="Play an exciting Wheel of Fortune game online. Spin the wheel and test your luck!"> + <meta name="keywords" content="wheel of fortune, spinning wheel, luck game, fortune wheel"> + <title>Wheel of Fortune | Spin & Win</title> + <link rel="stylesheet" href="style.css"> +</head> +<body> + <header> + <h1>Wheel of Fortune</h1> + </header> + + <main> + <div class="game-container"> + <div class="wheel-container"> + <div class="wheel" id="wheel"> + <div class="wheel-center"></div> + <div class="segment s1">100</div> + <div class="segment s2">200</div> + <div class="segment s3">300</div> + <div class="segment s4">400</div> + <div class="segment s5">500</div> + <div class="segment s6">600</div> + <div class="segment s7">700</div> + <div class="segment s8">800</div> + </div> + <div class="pointer"></div> + </div> + + <div class="controls"> + <button id="spinBtn" class="spin-button">SPIN</button> + <div class="score-display"> + <p>Score: <span id="score">0</span></p> + </div> + </div> + </div> + </main> + + <footer> + <p>Made with ❤️ by SpinWheel Games</p> + </footer> + + <script src="script.js"></script> +</body> +</html> diff --git a/script.js b/script.js new file mode 100644 index 0000000..a6460b0 --- /dev/null +++ b/script.js @@ -0,0 +1,73 @@ +document.addEventListener('DOMContentLoaded', () => { + const wheel = document.getElementById('wheel'); + const spinBtn = document.getElementById('spinBtn'); + const scoreDisplay = document.getElementById('score'); + + let score = 0; + let canSpin = true; + + // Create wheel segments with colors + const segments = document.querySelectorAll('.segment'); + const colors = ['#e74c3c', '#3498db', '#2ecc71', '#f1c40f', '#9b59b6', '#e67e22', '#1abc9c', '#34495e']; + + segments.forEach((segment, index) => { + segment.style.transform = `rotate(${index * 45}deg)`; + segment.style.background = colors[index]; + }); + + function getRandomDegrees() { + return Math.floor(Math.random() * 360) + 1440; // At least 4 full rotations + } + + function calculatePrize(degrees) { + const normalizedDegrees = degrees % 360; + const segment = Math.floor(normalizedDegrees / 45); + return (segment + 1) * 100; + } + + function updateScore(prize) { + score += prize; + scoreDisplay.textContent = score; + + // Add animation to score display + scoreDisplay.style.transform = 'scale(1.2)'; + setTimeout(() => { + scoreDisplay.style.transform = 'scale(1)'; + }, 200); + } + + spinBtn.addEventListener('click', () => { + if (!canSpin) return; + + canSpin = false; + spinBtn.disabled = true; + + const degrees = getRandomDegrees(); + wheel.style.transform = `rotate(${degrees}deg)`; + + // After spin completes + setTimeout(() => { + const prize = calculatePrize(degrees); + updateScore(prize); + canSpin = true; + spinBtn.disabled = false; + + // Show celebration effect + const celebration = document.createElement('div'); + celebration.className = 'celebration'; + document.body.appendChild(celebration); + setTimeout(() => celebration.remove(), 1000); + }, 4000); + }); + + // Add smooth transition for button state + spinBtn.addEventListener('mousedown', () => { + if (canSpin) { + spinBtn.style.transform = 'scale(0.95)'; + } + }); + + spinBtn.addEventListener('mouseup', () => { + spinBtn.style.transform = 'scale(1)'; + }); +}); diff --git a/style.css b/style.css new file mode 100644 index 0000000..06c62c6 --- /dev/null +++ b/style.css @@ -0,0 +1,144 @@ +:root { + --primary-color: #2c3e50; + --secondary-color: #e74c3c; + --accent-color: #f1c40f; + --text-color: #ecf0f1; + --wheel-size: min(80vw, 400px); +} + +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + font-family: 'Segoe UI', system-ui, sans-serif; + background: linear-gradient(135deg, #1a2a3a 0%, #2c3e50 100%); + min-height: 100vh; + display: flex; + flex-direction: column; + color: var(--text-color); +} + +header { + text-align: center; + padding: 2rem; + background: rgba(0, 0, 0, 0.2); +} + +h1 { + font-size: 2.5rem; + text-transform: uppercase; + letter-spacing: 3px; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3); +} + +.game-container { + flex: 1; + display: flex; + flex-direction: column; + align-items: center; + padding: 2rem; + gap: 2rem; +} + +.wheel-container { + position: relative; + width: var(--wheel-size); + height: var(--wheel-size); +} + +.wheel { + width: 100%; + height: 100%; + border-radius: 50%; + position: relative; + transition: transform 4s cubic-bezier(0.17, 0.67, 0.12, 0.99); + transform: rotate(0deg); + box-shadow: 0 0 50px rgba(0, 0, 0, 0.3); +} + +.wheel-center { + position: absolute; + width: 20%; + height: 20%; + background: var(--secondary-color); + border-radius: 50%; + top: 40%; + left: 40%; + z-index: 2; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); +} + +.segment { + position: absolute; + width: 50%; + height: 50%; + transform-origin: 100% 100%; + display: flex; + align-items: center; + justify-content: center; + font-size: 1.5rem; + font-weight: bold; + color: var(--text-color); + text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5); +} + +.pointer { + position: absolute; + top: -20px; + left: calc(50% - 20px); + width: 40px; + height: 40px; + background: var(--secondary-color); + clip-path: polygon(50% 100%, 0 0, 100% 0); + z-index: 3; +} + +.controls { + display: flex; + flex-direction: column; + align-items: center; + gap: 1rem; +} + +.spin-button { + padding: 1rem 3rem; + font-size: 1.2rem; + font-weight: bold; + background: var(--secondary-color); + color: var(--text-color); + border: none; + border-radius: 50px; + cursor: pointer; + transition: transform 0.2s, background-color 0.2s; + text-transform: uppercase; + letter-spacing: 2px; +} + +.spin-button:hover { + transform: scale(1.05); + background: #c0392b; +} + +.score-display { + font-size: 1.5rem; + font-weight: bold; +} + +footer { + text-align: center; + padding: 1rem; + background: rgba(0, 0, 0, 0.2); +} + +@media (max-width: 600px) { + h1 { + font-size: 2rem; + } + + .segment { + font-size: 1.2rem; + } +}