Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Quantum Dice Dilemma</title>
- <style>
- @import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');
- * {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- }
- body {
- font-family: 'Orbitron', monospace;
- background: linear-gradient(135deg, #0a0a2e 0%, #16213e 50%, #0f3460 100%);
- min-height: 100vh;
- color: #fff;
- overflow-x: hidden;
- }
- .quantum-background {
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background: radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
- radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
- radial-gradient(circle at 40% 80%, rgba(119, 198, 255, 0.3) 0%, transparent 50%);
- animation: quantumShift 8s ease-in-out infinite;
- z-index: -1;
- }
- @keyframes quantumShift {
- 0%, 100% { transform: translateX(0) translateY(0); }
- 25% { transform: translateX(-20px) translateY(-10px); }
- 50% { transform: translateX(20px) translateY(10px); }
- 75% { transform: translateX(-10px) translateY(20px); }
- }
- .container {
- max-width: 1200px;
- margin: 0 auto;
- padding: 20px;
- }
- .header {
- text-align: center;
- margin-bottom: 30px;
- }
- .title {
- font-size: 3rem;
- font-weight: 900;
- background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
- background-size: 400% 400%;
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- animation: gradientShift 3s ease-in-out infinite;
- margin-bottom: 10px;
- }
- @keyframes gradientShift {
- 0%, 100% { background-position: 0% 50%; }
- 50% { background-position: 100% 50%; }
- }
- .subtitle {
- font-size: 1.2rem;
- opacity: 0.8;
- margin-bottom: 20px;
- }
- .game-stats {
- display: flex;
- justify-content: center;
- gap: 40px;
- margin-bottom: 30px;
- flex-wrap: wrap;
- }
- .stat {
- text-align: center;
- padding: 15px 25px;
- background: rgba(255, 255, 255, 0.1);
- border-radius: 15px;
- backdrop-filter: blur(10px);
- border: 1px solid rgba(255, 255, 255, 0.2);
- }
- .stat-label {
- font-size: 0.9rem;
- opacity: 0.7;
- margin-bottom: 5px;
- }
- .stat-value {
- font-size: 1.8rem;
- font-weight: 700;
- color: #4ecdc4;
- }
- .quantum-dice-container {
- display: flex;
- justify-content: center;
- gap: 30px;
- margin: 40px 0;
- flex-wrap: wrap;
- }
- .quantum-die {
- position: relative;
- width: 120px;
- height: 120px;
- }
- .die {
- width: 100%;
- height: 100%;
- background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
- border-radius: 20px;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 3rem;
- font-weight: 900;
- color: white;
- box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
- transition: all 0.3s ease;
- cursor: pointer;
- }
- .die:hover {
- transform: translateY(-5px);
- box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
- }
- .quantum-veil {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background: linear-gradient(45deg,
- rgba(255, 255, 255, 0.3) 0%,
- rgba(120, 119, 198, 0.4) 25%,
- rgba(255, 119, 198, 0.4) 50%,
- rgba(119, 198, 255, 0.4) 75%,
- rgba(255, 255, 255, 0.3) 100%);
- border-radius: 20px;
- backdrop-filter: blur(8px);
- animation: quantumVeilPulse 2s ease-in-out infinite;
- transition: opacity 0.8s ease;
- }
- @keyframes quantumVeilPulse {
- 0%, 100% { opacity: 0.8; }
- 50% { opacity: 0.4; }
- }
- .quantum-veil.revealed {
- opacity: 0;
- pointer-events: none;
- }
- .probability-display {
- position: absolute;
- bottom: -30px;
- left: 50%;
- transform: translateX(-50%);
- font-size: 0.8rem;
- opacity: 0.7;
- text-align: center;
- }
- .betting-section {
- background: rgba(255, 255, 255, 0.1);
- border-radius: 20px;
- padding: 30px;
- margin: 30px 0;
- backdrop-filter: blur(10px);
- border: 1px solid rgba(255, 255, 255, 0.2);
- }
- .betting-title {
- font-size: 1.5rem;
- text-align: center;
- margin-bottom: 25px;
- color: #4ecdc4;
- }
- .bet-options {
- display: grid;
- grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
- gap: 20px;
- margin-bottom: 25px;
- }
- .bet-option {
- background: rgba(255, 255, 255, 0.05);
- border: 2px solid rgba(255, 255, 255, 0.2);
- border-radius: 15px;
- padding: 20px;
- text-align: center;
- cursor: pointer;
- transition: all 0.3s ease;
- }
- .bet-option:hover {
- background: rgba(255, 255, 255, 0.1);
- border-color: #4ecdc4;
- transform: translateY(-3px);
- }
- .bet-option.selected {
- background: rgba(78, 205, 196, 0.2);
- border-color: #4ecdc4;
- box-shadow: 0 0 20px rgba(78, 205, 196, 0.4);
- }
- .bet-label {
- font-size: 1.1rem;
- font-weight: 700;
- margin-bottom: 10px;
- }
- .bet-description {
- font-size: 0.9rem;
- opacity: 0.8;
- margin-bottom: 15px;
- }
- .bet-payout {
- font-size: 1.2rem;
- color: #ff6b6b;
- font-weight: 700;
- }
- .bet-amount-section {
- display: flex;
- justify-content: center;
- align-items: center;
- gap: 20px;
- margin: 25px 0;
- flex-wrap: wrap;
- }
- .bet-amount-input {
- background: rgba(255, 255, 255, 0.1);
- border: 2px solid rgba(255, 255, 255, 0.3);
- border-radius: 10px;
- padding: 10px 15px;
- color: white;
- font-family: 'Orbitron', monospace;
- font-size: 1.1rem;
- text-align: center;
- width: 120px;
- }
- .bet-amount-input:focus {
- outline: none;
- border-color: #4ecdc4;
- box-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
- }
- .controls {
- display: flex;
- justify-content: center;
- gap: 20px;
- margin: 30px 0;
- flex-wrap: wrap;
- }
- .btn {
- background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
- border: none;
- border-radius: 12px;
- padding: 15px 30px;
- color: white;
- font-family: 'Orbitron', monospace;
- font-size: 1.1rem;
- font-weight: 700;
- cursor: pointer;
- transition: all 0.3s ease;
- box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
- }
- .btn:hover:not(:disabled) {
- transform: translateY(-3px);
- box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
- }
- .btn:disabled {
- opacity: 0.5;
- cursor: not-allowed;
- }
- .btn-primary {
- background: linear-gradient(45deg, #4ecdc4 0%, #44a08d 100%);
- }
- .btn-danger {
- background: linear-gradient(45deg, #ff6b6b 0%, #ee5a52 100%);
- }
- .results-section {
- background: rgba(255, 255, 255, 0.1);
- border-radius: 20px;
- padding: 25px;
- margin: 25px 0;
- backdrop-filter: blur(10px);
- border: 1px solid rgba(255, 255, 255, 0.2);
- min-height: 100px;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .result-text {
- font-size: 1.3rem;
- text-align: center;
- line-height: 1.6;
- }
- .quantum-paths {
- background: rgba(255, 255, 255, 0.05);
- border-radius: 15px;
- padding: 20px;
- margin: 20px 0;
- border: 1px solid rgba(255, 255, 255, 0.1);
- }
- .paths-title {
- font-size: 1.2rem;
- margin-bottom: 15px;
- color: #4ecdc4;
- text-align: center;
- }
- .path-item {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 10px 15px;
- margin: 5px 0;
- background: rgba(255, 255, 255, 0.05);
- border-radius: 8px;
- border-left: 4px solid #4ecdc4;
- }
- .rolling {
- animation: diceRoll 1s ease-in-out infinite;
- }
- @keyframes diceRoll {
- 0%, 100% { transform: rotate(0deg); }
- 25% { transform: rotate(90deg); }
- 50% { transform: rotate(180deg); }
- 75% { transform: rotate(270deg); }
- }
- @media (max-width: 768px) {
- .title {
- font-size: 2rem;
- }
- .game-stats {
- gap: 20px;
- }
- .quantum-dice-container {
- gap: 20px;
- }
- .quantum-die {
- width: 100px;
- height: 100px;
- }
- .die {
- font-size: 2.5rem;
- }
- }
- </style>
- </head>
- <body>
- <div class="quantum-background"></div>
- <div class="container">
- <div class="header">
- <h1 class="title">Quantum Dice Dilemma</h1>
- <p class="subtitle">Roll dice in quantum superposition. Observe to collapse reality.</p>
- </div>
- <div class="game-stats">
- <div class="stat">
- <div class="stat-label">Credits</div>
- <div class="stat-value" id="credits">1000</div>
- </div>
- <div class="stat">
- <div class="stat-label">Round</div>
- <div class="stat-value" id="round">1</div>
- </div>
- <div class="stat">
- <div class="stat-label">Total Winnings</div>
- <div class="stat-value" id="totalWinnings">0</div>
- </div>
- </div>
- <div class="quantum-dice-container">
- <div class="quantum-die">
- <div class="die" id="die1">?</div>
- <div class="quantum-veil" id="veil1"></div>
- <div class="probability-display" id="prob1">Superposition</div>
- </div>
- <div class="quantum-die">
- <div class="die" id="die2">?</div>
- <div class="quantum-veil" id="veil2"></div>
- <div class="probability-display" id="prob2">Superposition</div>
- </div>
- </div>
- <div class="betting-section">
- <h3 class="betting-title">Place Your Quantum Bets</h3>
- <div class="bet-options">
- <div class="bet-option" data-bet="sum-even">
- <div class="bet-label">Sum is Even</div>
- <div class="bet-description">Both dice sum to an even number</div>
- <div class="bet-payout">2:1 payout</div>
- </div>
- <div class="bet-option" data-bet="sum-odd">
- <div class="bet-label">Sum is Odd</div>
- <div class="bet-description">Both dice sum to an odd number</div>
- <div class="bet-payout">2:1 payout</div>
- </div>
- <div class="bet-option" data-bet="doubles">
- <div class="bet-label">Doubles</div>
- <div class="bet-description">Both dice show the same number</div>
- <div class="bet-payout">6:1 payout</div>
- </div>
- <div class="bet-option" data-bet="high-sum">
- <div class="bet-label">High Sum (8-12)</div>
- <div class="bet-description">Sum is 8 or higher</div>
- <div class="bet-payout">3:1 payout</div>
- </div>
- <div class="bet-option" data-bet="low-sum">
- <div class="bet-label">Low Sum (2-6)</div>
- <div class="bet-description">Sum is 6 or lower</div>
- <div class="bet-payout">3:1 payout</div>
- </div>
- <div class="bet-option" data-bet="quantum-anomaly">
- <div class="bet-label">Quantum Anomaly</div>
- <div class="bet-description">Rare quantum events (sum = 2 or 12)</div>
- <div class="bet-payout">15:1 payout</div>
- </div>
- </div>
- <div class="bet-amount-section">
- <label for="betAmount">Bet Amount:</label>
- <input type="number" id="betAmount" class="bet-amount-input" value="50" min="1" max="1000">
- <span>Credits</span>
- </div>
- </div>
- <div class="controls">
- <button class="btn btn-primary" id="rollBtn">Roll Quantum Dice</button>
- <button class="btn" id="observeBtn" disabled>Observe & Collapse</button>
- <button class="btn btn-danger" id="resetBtn">Reset Game</button>
- </div>
- <div class="results-section">
- <div class="result-text" id="resultText">Place your bets and roll the quantum dice!</div>
- </div>
- <div class="quantum-paths">
- <h4 class="paths-title">Quantum Path History</h4>
- <div id="pathHistory"></div>
- </div>
- </div>
- <script>
- class QuantumDiceGame {
- constructor() {
- this.credits = 1000;
- this.round = 1;
- this.totalWinnings = 0;
- this.currentBets = new Map();
- this.quantumStates = [];
- this.pathHistory = [];
- this.isRolling = false;
- this.hasRolled = false;
- this.initializeGame();
- this.bindEvents();
- }
- initializeGame() {
- this.updateDisplay();
- this.clearBets();
- }
- bindEvents() {
- // Bet selection
- document.querySelectorAll('.bet-option').forEach(option => {
- option.addEventListener('click', () => this.toggleBet(option));
- });
- // Control buttons
- document.getElementById('rollBtn').addEventListener('click', () => this.rollDice());
- document.getElementById('observeBtn').addEventListener('click', () => this.observeQuantumState());
- document.getElementById('resetBtn').addEventListener('click', () => this.resetGame());
- // Bet amount input
- document.getElementById('betAmount').addEventListener('input', (e) => {
- const value = parseInt(e.target.value);
- if (value > this.credits) {
- e.target.value = this.credits;
- }
- });
- }
- toggleBet(option) {
- if (this.hasRolled) return;
- const betType = option.dataset.bet;
- const betAmount = parseInt(document.getElementById('betAmount').value);
- if (betAmount > this.credits) {
- this.showResult("Insufficient credits for this bet!", "error");
- return;
- }
- if (option.classList.contains('selected')) {
- option.classList.remove('selected');
- this.currentBets.delete(betType);
- } else {
- // Check if player has enough credits for all selected bets
- const totalBetAmount = Array.from(this.currentBets.values()).reduce((sum, bet) => sum + bet.amount, 0) + betAmount;
- if (totalBetAmount > this.credits) {
- this.showResult("Not enough credits for all selected bets!", "error");
- return;
- }
- option.classList.add('selected');
- this.currentBets.set(betType, {
- amount: betAmount,
- payout: this.getBetPayout(betType)
- });
- }
- this.updateBetDisplay();
- }
- getBetPayout(betType) {
- const payouts = {
- 'sum-even': 2,
- 'sum-odd': 2,
- 'doubles': 6,
- 'high-sum': 3,
- 'low-sum': 3,
- 'quantum-anomaly': 15
- };
- return payouts[betType] || 1;
- }
- updateBetDisplay() {
- const totalBet = Array.from(this.currentBets.values()).reduce((sum, bet) => sum + bet.amount, 0);
- const betAmountInput = document.getElementById('betAmount');
- betAmountInput.max = Math.max(1, this.credits - totalBet + parseInt(betAmountInput.value));
- }
- rollDice() {
- if (this.currentBets.size === 0) {
- this.showResult("Please place at least one bet before rolling!", "error");
- return;
- }
- const totalBetAmount = Array.from(this.currentBets.values()).reduce((sum, bet) => sum + bet.amount, 0);
- if (totalBetAmount > this.credits) {
- this.showResult("Not enough credits for your bets!", "error");
- return;
- }
- this.isRolling = true;
- this.hasRolled = true;
- this.credits -= totalBetAmount;
- // Generate quantum superposition states
- this.generateQuantumStates();
- // Visual rolling animation
- const die1 = document.getElementById('die1');
- const die2 = document.getElementById('die2');
- die1.classList.add('rolling');
- die2.classList.add('rolling');
- // Show probabilistic state
- this.updateProbabilityDisplays();
- // Enable observation after delay
- setTimeout(() => {
- die1.classList.remove('rolling');
- die2.classList.remove('rolling');
- this.isRolling = false;
- document.getElementById('rollBtn').disabled = true;
- document.getElementById('observeBtn').disabled = false;
- this.showResult("Dice are in quantum superposition! Click 'Observe' to collapse the wave function.", "info");
- }, 2000);
- this.updateDisplay();
- }
- generateQuantumStates() {
- this.quantumStates = [];
- // Generate all possible outcomes with probabilities
- for (let d1 = 1; d1 <= 6; d1++) {
- for (let d2 = 1; d2 <= 6; d2++) {
- this.quantumStates.push({
- die1: d1,
- die2: d2,
- probability: 1/36
- });
- }
- }
- }
- updateProbabilityDisplays() {
- const prob1 = document.getElementById('prob1');
- const prob2 = document.getElementById('prob2');
- prob1.textContent = "Probability Cloud";
- prob2.textContent = "All Outcomes Possible";
- // Show quantum uncertainty in die display
- const die1 = document.getElementById('die1');
- const die2 = document.getElementById('die2');
- let counter = 0;
- const uncertainty = setInterval(() => {
- if (!this.isRolling && !document.getElementById('observeBtn').disabled) {
- clearInterval(uncertainty);
- return;
- }
- die1.textContent = Math.floor(Math.random() * 6) + 1;
- die2.textContent = Math.floor(Math.random() * 6) + 1;
- counter++;
- if (counter > 20 && !this.isRolling) {
- clearInterval(uncertainty);
- die1.textContent = "?";
- die2.textContent = "?";
- }
- }, 100);
- }
- observeQuantumState() {
- // Collapse the quantum state
- const collapsedState = this.collapseQuantumState();
- // Reveal the dice
- document.getElementById('die1').textContent = collapsedState.die1;
- document.getElementById('die2').textContent = collapsedState.die2;
- // Remove quantum veils
- document.getElementById('veil1').classList.add('revealed');
- document.getElementById('veil2').classList.add('revealed');
- // Update probability displays
- document.getElementById('prob1').textContent = `Observed: ${collapsedState.die1}`;
- document.getElementById('prob2').textContent = `Observed: ${collapsedState.die2}`;
- // Calculate results
- this.calculateResults(collapsedState);
- // Add to path history
- this.addToPathHistory(collapsedState);
- // Prepare for next round
- setTimeout(() => {
- this.prepareNextRound();
- }, 3000);
- }
- collapseQuantumState() {
- // Weighted random selection (though all outcomes are equally likely in fair dice)
- const randomIndex = Math.floor(Math.random() * this.quantumStates.length);
- return this.quantumStates[randomIndex];
- }
- calculateResults(state) {
- const sum = state.die1 + state.die2;
- let totalWinnings = 0;
- let resultDetails = [];
- for (const [betType, bet] of this.currentBets) {
- let won = false;
- switch (betType) {
- case 'sum-even':
- won = sum % 2 === 0;
- break;
- case 'sum-odd':
- won = sum % 2 === 1;
- break;
- case 'doubles':
- won = state.die1 === state.die2;
- break;
- case 'high-sum':
- won = sum >= 8;
- break;
- case 'low-sum':
- won = sum <= 6;
- break;
- case 'quantum-anomaly':
- won = sum === 2 || sum === 12;
- break;
- }
- if (won) {
- const winAmount = bet.amount * bet.payout;
- totalWinnings += winAmount;
- resultDetails.push(`${betType}: WON ${winAmount} credits (${bet.payout}:1)`);
- } else {
- resultDetails.push(`${betType}: LOST ${bet.amount} credits`);
- }
- }
- this.credits += totalWinnings;
- this.totalWinnings += totalWinnings - Array.from(this.currentBets.values()).reduce((sum, bet) => sum + bet.amount, 0);
- const resultText = `
- Dice: ${state.die1} + ${state.die2} = ${sum}<br>
- ${resultDetails.join('<br>')}<br>
- <strong>Net Result: ${totalWinnings > 0 ? '+' : ''}${totalWinnings - Array.from(this.currentBets.values()).reduce((sum, bet) => sum + bet.amount, 0)} credits</strong>
- `;
- this.showResult(resultText, totalWinnings > 0 ? "success" : "error");
- this.updateDisplay();
- }
- addToPathHistory(state) {
- const sum = state.die1 + state.die2;
- const pathItem = {
- round: this.round,
- dice: `${state.die1}, ${state.die2}`,
- sum: sum,
- timestamp: new Date().toLocaleTimeString()
- };
- this.pathHistory.unshift(pathItem);
- if (this.pathHistory.length > 10) {
- this.pathHistory.pop();
- }
- this.updatePathDisplay();
- }
- updatePathDisplay() {
- const pathHistoryEl = document.getElementById('pathHistory');
- pathHistoryEl.innerHTML = '';
- this.pathHistory.forEach(path => {
- const pathEl = document.createElement('div');
- pathEl.className = 'path-item';
- pathEl.innerHTML = `
- <span>Round ${path.round}: [${path.dice}] = ${path.sum}</span>
- <span>${path.timestamp}</span>
- `;
- pathHistoryEl.appendChild(pathEl);
- });
- }
- prepareNextRound() {
- this.round++;
- this.hasRolled = false;
- // Reset quantum veils
- document.getElementById('veil1').classList.remove('revealed');
- document.getElementById('veil2').classList.remove('revealed');
- // Reset dice display
- document.getElementById('die1').textContent = '?';
- document.getElementById('die2').textContent = '?';
- // Reset probability displays
- document.getElementById('prob1').textContent = 'Superposition';
- document.getElementById('prob2').textContent = 'Superposition';
- // Reset buttons
- document.getElementById('rollBtn').disabled = false;
- document.getElementById('observeBtn').disabled = true;
- // Clear bets
- this.clearBets();
- // Check game over
- if (this.credits <= 0) {
- this.gameOver();
- } else {
- this.showResult("Ready for next quantum roll!", "info");
- }
- this.updateDisplay();
- }
- clearBets() {
- this.currentBets.clear();
- document.querySelectorAll('.bet-option').forEach(option => {
- option.classList.remove('selected');
- });
- this.updateBetDisplay();
- }
- gameOver() {
- this.showResult(`Game Over! You played ${this.round - 1} rounds with a total return of ${this.totalWinnings} credits.`, "error");
- document.getElementById('rollBtn').disabled = true;
- document.getElementById('observeBtn').disabled = true;
- }
- resetGame() {
- this.credits = 1000;
- this.round = 1;
- this.totalWinnings = 0;
- this.currentBets.clear();
- this.quantumStates = [];
- this.pathHistory = [];
- this.isRolling = false;
- this.hasRolled = false;
- // Reset UI
- document.getElementById('die1').textContent = '?';
- document.getElementById('die2').textContent = '?';
- document.getElementById('veil1').classList.remove('revealed');
- document.getElementById('veil2').classList.remove('revealed');
- document.getElementById('prob1').textContent = 'Superposition';
- document.getElementById('prob2').textContent = 'Superposition';
- document.getElementById('rollBtn').disabled = false;
- document.getElementById('observeBtn').disabled = true;
- this.clearBets();
- this.updateDisplay();
- this.updatePathDisplay();
- this.showResult("Game reset! Place your bets and roll the quantum dice!", "info");
- }
- updateDisplay() {
- document.getElementById('credits').textContent = this.credits;
- document.getElementById('round').textContent = this.round;
- document.getElementById('totalWinnings').textContent = this.totalWinnings;
- }
- showResult(message, type = "info") {
- const resultEl = document.getElementById('resultText');
- resultEl.innerHTML = message;
- // Add visual feedback based on type
- resultEl.style.color = type === "success" ? "#4ecdc4" :
- type === "error" ? "#ff6b6b" : "#fff";
- }
- }
- // Initialize the game when the page loads
- document.addEventListener('DOMContentLoaded', () => {
- new QuantumDiceGame();
- });
- // Add some quantum particle effects
- function createQuantumParticle() {
- const particle = document.createElement('div');
- particle.style.position = 'fixed';
- particle.style.width = '3px';
- particle.style.height = '3px';
- particle.style.backgroundColor = `hsl(${Math.random() * 360}, 70%, 70%)`;
- particle.style.borderRadius = '50%';
- particle.style.pointerEvents = 'none';
- particle.style.zIndex = '1000';
- particle.style.opacity = '0.8';
- const x = Math.random() * window.innerWidth;
- const y = Math.random() * window.innerHeight;
- particle.style.left = x + 'px';
- particle.style.top = y + 'px';
- document.body.appendChild(particle);
- // Animate the particle
- const animation = particle.animate([
- {
- transform: 'translate(0, 0) scale(1)',
- opacity: 0.8
- },
- {
- transform: `translate(${(Math.random() - 0.5) * 200}px, ${(Math.random() - 0.5) * 200}px) scale(0)`,
- opacity: 0
- }
- ], {
- duration: 3000 + Math.random() * 2000,
- easing: 'ease-out'
- });
- animation.onfinish = () => {
- particle.remove();
- };
- }
- // Create quantum particles periodically
- setInterval(() => {
- if (Math.random() < 0.3) {
- createQuantumParticle();
- }
- }, 500);
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment