Changes to spinwheel.scroll.pub

root
root
29 days ago
Initial commit
README.md
Changed around line 1
+ # spinwheel.scroll.pub
+ Website generated from prompt: make a wheel of fortune game
index.html
Changed around line 1
+
+
+
+
+
+
+
+ Wheel of Fortune | Spin & Win
+
+
+
+
+

Wheel of Fortune

+
+
+
+
+
+
+
+
100
+
200
+
300
+
400
+
500
+
600
+
700
+
800
+
+
+
+
+
+
+
+

Score: 0

+
+
+
+
+
+
+

Made with ❤️ by SpinWheel Games

+
+
+
+
+
script.js
Changed around line 1
+ 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)';
+ });
+ });
style.css
Changed around line 1
+ :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;
+ }
+ }