Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files12345678910111213141516171819<!doctype html><html><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width" /><title>My static Space</title><link rel="stylesheet" href="style.css" /></head><body><div class="card"><h1>Welcome to your static Space!</h1><p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p><p>Also don't forget to check the<a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.</p></div></body></html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Cheers 3D - Clink & Celebrate!</title><link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=Space+Grotesk:wght@300;400;600&display=swap" rel="stylesheet"><script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script><style>:root {--bg: #0a0a12;--fg: #f4f0e8;--muted: #6b6b7b;--accent: #ffd700;--accent-glow: rgba(255, 215, 0, 0.4);--card: rgba(255, 255, 255, 0.05);--border: rgba(255, 255, 255, 0.1);--glass: rgba(200, 220, 255, 0.15);--liquid: rgba(255, 200, 100, 0.6);}* {margin: 0;padding: 0;box-sizing: border-box;}body {font-family: 'Space Grotesk', sans-serif;background: var(--bg);color: var(--fg);min-height: 100vh;overflow: hidden;position: relative;}#canvas-container {position: fixed;top: 0;left: 0;width: 100%;height: 100%;z-index: 1;}.ui-overlay {position: fixed;z-index: 10;pointer-events: none;}.header {top: 0;left: 0;right: 0;padding: 1.5rem 2rem;display: flex;justify-content: space-between;align-items: center;background: linear-gradient(to bottom, rgba(10, 10, 18, 0.9), transparent);}.logo {font-family: 'Playfair Display', serif;font-size: clamp(1.5rem, 4vw, 2.5rem);font-weight: 900;background: linear-gradient(135deg, var(--accent), #fff8dc);-webkit-background-clip: text;-webkit-text-fill-color: transparent;background-clip: text;letter-spacing: 0.05em;}.logo-link {text-decoration: none;pointer-events: auto;}.built-with {font-size: 0.7rem;color: var(--muted);text-decoration: none;pointer-events: auto;transition: color 0.3s ease;}.built-with:hover {color: var(--accent);}.score-panel {top: 50%;right: 2rem;transform: translateY(-50%);text-align: right;}.score-label {font-size: 0.75rem;text-transform: uppercase;letter-spacing: 0.2em;color: var(--muted);margin-bottom: 0.5rem;}.score-value {font-family: 'Playfair Display', serif;font-size: clamp(3rem, 8vw, 6rem);font-weight: 900;color: var(--accent);line-height: 1;text-shadow: 0 0 40px var(--accent-glow);}.combo-display {margin-top: 1rem;font-size: 1rem;color: var(--fg);opacity: 0;transform: translateY(10px);transition: all 0.3s ease;}.combo-display.active {opacity: 1;transform: translateY(0);}.instructions {bottom: 2rem;left: 50%;transform: translateX(-50%);text-align: center;background: var(--card);backdrop-filter: blur(20px);border: 1px solid var(--border);border-radius: 1rem;padding: 1rem 2rem;pointer-events: auto;}.instructions h2 {font-family: 'Playfair Display', serif;font-size: 1.25rem;margin-bottom: 0.5rem;color: var(--accent);}.instructions p {font-size: 0.875rem;color: var(--muted);max-width: 300px;}.cheers-text {position: fixed;top: 50%;left: 50%;transform: translate(-50%, -50%) scale(0);font-family: 'Playfair Display', serif;font-size: clamp(3rem, 15vw, 8rem);font-weight: 900;color: var(--accent);text-shadow: 0 0 60px var(--accent-glow), 0 0 120px var(--accent-glow);z-index: 20;pointer-events: none;opacity: 0;transition: all 0.1s ease;}.cheers-text.show {animation: cheersPop 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;}@keyframes cheersPop {0% {transform: translate(-50%, -50%) scale(0) rotate(-10deg);opacity: 0;}50% {transform: translate(-50%, -50%) scale(1.2) rotate(5deg);opacity: 1;}100% {transform: translate(-50%, -50%) scale(1) rotate(0deg);opacity: 0;}}.glass-selector {bottom: 8rem;left: 50%;transform: translateX(-50%);display: flex;gap: 1rem;pointer-events: auto;}.glass-btn {width: 60px;height: 60px;border-radius: 50%;border: 2px solid var(--border);background: var(--card);backdrop-filter: blur(10px);cursor: pointer;transition: all 0.3s ease;display: flex;align-items: center;justify-content: center;color: var(--fg);}.glass-btn:hover {border-color: var(--accent);transform: scale(1.1);}.glass-btn.active {border-color: var(--accent);background: rgba(255, 215, 0, 0.2);box-shadow: 0 0 20px var(--accent-glow);}.glass-btn svg {width: 28px;height: 28px;}.ambient-orb {position: fixed;width: 400px;height: 400px;border-radius: 50%;background: radial-gradient(circle, var(--accent-glow), transparent 70%);filter: blur(80px);pointer-events: none;z-index: 0;opacity: 0.3;animation: orbFloat 8s ease-in-out infinite;}.orb-1 {top: -100px;left: -100px;}.orb-2 {bottom: -100px;right: -100px;background: radial-gradient(circle, rgba(255, 100, 150, 0.3), transparent 70%);animation-delay: -4s;}@keyframes orbFloat {0%, 100% { transform: translate(0, 0); }50% { transform: translate(30px, 30px); }}.streak-bar {position: fixed;bottom: 0;left: 0;right: 0;height: 4px;background: var(--border);z-index: 15;}.streak-fill {height: 100%;background: linear-gradient(90deg, var(--accent), #ff6b6b);width: 0%;transition: width 0.3s ease;box-shadow: 0 0 20px var(--accent);}@media (max-width: 768px) {.header {padding: 1rem;}.score-panel {right: 1rem;}.instructions {left: 1rem;right: 1rem;transform: none;padding: 0.75rem 1rem;}.glass-selector {bottom: 6rem;}.glass-btn {width: 50px;height: 50px;}}@media (prefers-reduced-motion: reduce) {*, *::before, *::after {animation-duration: 0.01ms !important;animation-iteration-count: 1 !important;transition-duration: 0.01ms !important;}}</style></head><body><div class="ambient-orb orb-1"></div><div class="ambient-orb orb-2"></div><div id="canvas-container"></div><header class="ui-overlay header"><a href="https://huggingface.co/spaces/akhaliq/anycoder" class="built-with" target="_blank" rel="noopener">Built with anycoder</a><div class="logo">CHEERS 3D</div><div style="width: 100px;"></div></header><div class="ui-overlay score-panel"><div class="score-label">Cheers Score</div><div class="score-value" id="score">0</div><div class="combo-display" id="combo">Combo x1</div></div><div class="ui-overlay instructions"><h2>Click & Drag to Clink!</h2><p>Drag glasses together to cheers. Chain multiple clinks for combo points!</p></div><div class="ui-overlay glass-selector"><button class="glass-btn active" data-type="champagne" aria-label="Champagne glass"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M8 22h8M12 22v-4M12 18c-4 0-6-3-6-6V2h12v10c0 3-2 6-6 6z"/></svg></button><button class="glass-btn" data-type="wine" aria-label="Wine glass"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M8 22h8M12 22v-4M12 18c-3 0-4-2-4-5V2h8v11c0 3-1 5-4 5z"/></svg></button><button class="glass-btn" data-type="beer" aria-label="Beer mug"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M17 8h2a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-2M6 8h11v10a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2V8zM6 8V6a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v2"/></svg></button></div><div class="streak-bar"><div class="streak-fill" id="streakFill"></div></div><div class="cheers-text" id="cheersText">CHEERS!</div><script>// Game Stateconst state = {score: 0,combo: 0,lastClinkTime: 0,streak: 0,maxStreak: 100,selectedGlass: 'champagne'};// Three.js Setuplet scene, camera, renderer, glasses = [], particles = [], confetti = [];let raycaster, mouse, selectedObject = null, offset = new THREE.Vector3();let isDragging = false;function init() {// Scenescene = new THREE.Scene();scene.fog = new THREE.FogExp2(0x0a0a12, 0.02);// Cameracamera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 1000);camera.position.set(0, 3, 8);camera.lookAt(0, 1, 0);// Rendererrenderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });renderer.setSize(window.innerWidth, window.innerHeight);renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));renderer.shadowMap.enabled = true;renderer.shadowMap.type = THREE.PCFSoftShadowMap;document.getElementById('canvas-container').appendChild(renderer.domElement);// Lightsconst ambientLight = new THREE.AmbientLight(0x404060, 0.5);scene.add(ambientLight);const mainLight = new THREE.DirectionalLight(0xffffff, 1);mainLight.position.set(5, 10, 5);mainLight.castShadow = true;mainLight.shadow.mapSize.width = 2048;mainLight.shadow.mapSize.height = 2048;scene.add(mainLight);const accentLight = new THREE.PointLight(0xffd700, 1, 20);accentLight.position.set(0, 5, 0);scene.add(accentLight);const rimLight = new THREE.PointLight(0xff6b6b, 0.5, 15);rimLight.position.set(-5, 3, -5);scene.add(rimLight);// Floorconst floorGeometry = new THREE.CircleGeometry(10, 64);const floorMaterial = new THREE.MeshStandardMaterial({color: 0x1a1a2e,roughness: 0.8,metalness: 0.2});const floor = new THREE.Mesh(floorGeometry, floorMaterial);floor.rotation.x = -Math.PI / 2;floor.receiveShadow = true;scene.add(floor);// Tableconst tableGeometry = new THREE.CylinderGeometry(3, 3.2, 0.3, 32);const tableMaterial = new THREE.MeshStandardMaterial({color: 0x2d1810,roughness: 0.4,metalness: 0.1});const table = new THREE.Mesh(tableGeometry, tableMaterial);table.position.y = 0.15;table.receiveShadow = true;table.castShadow = true;scene.add(table);// Create glassescreateGlasses();// Raycaster for interactionraycaster = new THREE.Raycaster();mouse = new THREE.Vector2();// Event ListenerssetupEventListeners();// Start animationanimate();}function createGlassGeometry(type) {const group = new THREE.Group();// Glass materialconst glassMaterial = new THREE.MeshPhysicalMaterial({color: 0xffffff,transparent: true,opacity: 0.3,roughness: 0.1,metalness: 0,transmission: 0.9,thickness: 0.5});// Liquid materialconst liquidMaterial = new THREE.MeshPhysicalMaterial({color: type === 'beer' ? 0xd4a03c : 0xffd700,transparent: true,opacity: 0.7,roughness: 0.2,metalness: 0.1});if (type === 'champagne') {// Flute shapeconst bowlGeometry = new THREE.LatheGeometry([new THREE.Vector2(0, 0),new THREE.Vector2(0.15, 0),new THREE.Vector2(0.4, 0.8),new THREE.Vector2(0.35, 1.5),new THREE.Vector2(0.25, 2),new THREE.Vector2(0.15, 2.2),new THREE.Vector2(0, 2.2)], 32);const bowl = new THREE.Mesh(bowlGeometry, glassMaterial);group.add(bowl);// Liquidconst liquidGeometry = new THREE.LatheGeometry([new THREE.Vector2(0, 0.1),new THREE.Vector2(0.35, 0.8),new THREE.Vector2(0.32, 1.3),new THREE.Vector2(0.2, 1.8),new THREE.Vector2(0, 1.8)], 32);const liquid = new THREE.Mesh(liquidGeometry, liquidMaterial);group.add(liquid);// Stemconst stemGeometry = new THREE.CylinderGeometry(0.05, 0.05, 1, 16);const stem = new THREE.Mesh(stemGeometry, glassMaterial);stem.position.y = -0.5;group.add(stem);// Baseconst baseGeometry = new THREE.CylinderGeometry(0.25, 0.3, 0.1, 32);const base = new THREE.Mesh(baseGeometry, glassMaterial);base.position.y = -1;group.add(base);} else if (type === 'wine') {// Wine glass shapeconst bowlGeometry = new THREE.LatheGeometry([new THREE.Vector2(0, 0),new THREE.Vector2(0.12, 0),new THREE.Vector2(0.5, 0.3),new THREE.Vector2(0.55, 0.6),new THREE.Vector2(0.4, 1.2),new THREE.Vector2(0.25, 1.6),new THREE.Vector2(0.12, 1.7),new THREE.Vector2(0, 1.7)], 32);const bowl = new THREE.Mesh(bowlGeometry, glassMaterial);group.add(bowl);// Liquidconst liquidGeometry = new THREE.LatheGeometry([new THREE.Vector2(0, 0.1),new THREE.Vector2(0.45, 0.35),new THREE.Vector2(0.5, 0.5),new THREE.Vector2(0.35, 1),new THREE.Vector2(0.2, 1.3),new THREE.Vector2(0, 1.3)], 32);const liquid = new THREE.Mesh(liquidGeometry, new THREE.MeshPhysicalMaterial({color: 0x722f37,transparent: true,opacity: 0.8,roughness: 0.2}));group.add(liquid);// Stemconst stemGeometry = new THREE.CylinderGeometry(0.04, 0.04, 1.2, 16);const stem = new THREE.Mesh(stemGeometry, glassMaterial);stem.position.y = -0.6;group.add(stem);// Baseconst baseGeometry = new THREE.CylinderGeometry(0.22, 0.26, 0.08, 32);const base = new THREE.Mesh(baseGeometry, glassMaterial);base.position.y = -1.2;group.add(base);} else if (type === 'beer') {// Beer mugconst mugGeometry = new THREE.CylinderGeometry(0.35, 0.32, 1.5, 32, 1, true);const mug = new THREE.Mesh(mugGeometry, glassMaterial);mug.position.y = 0.75;group.add(mug);// Bottomconst bottomGeometry = new THREE.CylinderGeometry(0.32, 0.32, 0.08, 32);const bottom = new THREE.Mesh(bottomGeometry, glassMaterial);bottom.position.y = 0.04;group.add(bottom);// Liquidconst liquidGeometry = new THREE.CylinderGeometry(0.32, 0.29, 1.2, 32);const liquid = new THREE.Mesh(liquidGeometry, liquidMaterial);liquid.position.y = 0.7;group.add(liquid);// Foamconst foamGeometry = new THREE.SphereGeometry(0.33, 32, 16, 0, Math.PI * 2, 0, Math.PI / 2);const foamMaterial = new THREE.MeshStandardMaterial({color: 0xfff8dc,roughness: 0.8});const foam = new THREE.Mesh(foamGeometry, foamMaterial);foam.position.y = 1.35;foam.scale.y = 0.5;group.add(foam);// Handleconst handleGeometry = new THREE.TorusGeometry(0.2, 0.04, 8, 16, Math.PI);const handle = new THREE.Mesh(handleGeometry, glassMaterial);handle.position.set(0.38, 0.75, 0);handle.rotation.z = Math.PI / 2;group.add(handle);}group.castShadow = true;group.traverse((child) => {if (child.isMesh) {child.castShadow = true;child.receiveShadow = true;}});return group;}function createGlasses() {// Clear existing glassesglasses.forEach(glass => scene.remove(glass));glasses = [];// Create two glassesconst positions = [{ x: -1.5, y: 0.3, z: 0 },{ x: 1.5, y: 0.3, z: 0 }];positions.forEach((pos, index) => {const glass = createGlassGeometry(state.selectedGlass);glass.position.set(pos.x, pos.y, pos.z);glass.userData = {index: index,originalPos: { ...pos },velocity: new THREE.Vector3()};scene.add(glass);glasses.push(glass);});}function createBubbles(position) {for (let i = 0; i < 20; i++) {const geometry = new THREE.SphereGeometry(Math.random() * 0.05 + 0.02, 8, 8);const material = new THREE.MeshBasicMaterial({color: 0xffffff,transparent: true,opacity: 0.6});const bubble = new THREE.Mesh(geometry, material);bubble.position.copy(position);bubble.position.y += 1;bubble.position.x += (Math.random() - 0.5) * 0.5;bubble.position.z += (Math.random() - 0.5) * 0.5;bubble.userData = {velocity: new THREE.Vector3((Math.random() - 0.5) * 0.02,Math.random() * 0.05 + 0.02,(Math.random() - 0.5) * 0.02),life: 1};scene.add(bubble);particles.push(bubble);}}function createConfetti() {const colors = [0xffd700, 0xff6b6b, 0x4ecdc4, 0xff69b4, 0x87ceeb];for (let i = 0; i < 50; i++) {const geometry = new THREE.BoxGeometry(0.05, 0.05, 0.01);const material = new THREE.MeshBasicMaterial({color: colors[Math.floor(Math.random() * colors.length)]});const confetto = new THREE.Mesh(geometry, material);confetto.position.set((Math.random() - 0.5) * 2,5 + Math.random() * 2,(Math.random() - 0.5) * 2);confetto.rotation.set(Math.random() * Math.PI,Math.random() * Math.PI,Math.random() * Math.PI);confetto.userData = {velocity: new THREE.Vector3((Math.random() - 0.5) * 0.05,-0.05 - Math.random() * 0.05,(Math.random() - 0.5) * 0.05),rotationSpeed: new THREE.Vector3(Math.random() * 0.1,Math.random() * 0.1,Math.random() * 0.1),life: 1};scene.add(confetto);confetti.push(confetto);}}function checkCollision() {if (glasses.length < 2) return false;const glass1 = glasses[0];const glass2 = glasses[1];const distance = glass1.position.distanceTo(glass2.position);return distance < 0.8;}function handleClink() {const now = Date.now();const timeSinceLastClink = now - state.lastClinkTime;if (timeSinceLastClink < 500) return; // Prevent spamstate.lastClinkTime = now;state.combo = timeSinceLastClink < 2000 ? state.combo + 1 : 1;state.streak = Math.min(state.streak + 10, state.maxStreak);const points = 100 * state.combo;state.score += points;updateUI();showCheersText();createBubbles(glasses[0].position);createBubbles(glasses[1].position);createConfetti();// Add impulse to glassesglasses.forEach(glass => {glass.userData.velocity.x = (Math.random() - 0.5) * 0.1;glass.userData.velocity.z = (Math.random() - 0.5) * 0.1;});}function updateUI() {document.getElementById('score').textContent = state.score;document.getElementById('streakFill').style.width = `${state.streak}%`;const comboDisplay = document.getElementById('combo');if (state.combo > 1) {comboDisplay.textContent = `Combo x${state.combo}`;comboDisplay.classList.add('active');} else {comboDisplay.classList.remove('active');}}function showCheersText() {const cheersText = document.getElementById('cheersText');cheersText.classList.remove('show');void cheersText.offsetWidth; // Trigger reflowcheersText.classList.add('show');}function setupEventListeners() {const canvas = renderer.domElement;// Mouse eventscanvas.addEventListener('mousedown', onMouseDown);canvas.addEventListener('mousemove', onMouseMove);canvas.addEventListener('mouseup', onMouseUp);// Touch eventscanvas.addEventListener('touchstart', onTouchStart, { passive: false });canvas.addEventListener('touchmove', onTouchMove, { passive: false });canvas.addEventListener('touchend', onTouchEnd);// Glass selectordocument.querySelectorAll('.glass-btn').forEach(btn => {btn.addEventListener('click', () => {document.querySelectorAll('.glass-btn').forEach(b => b.classList.remove('active'));btn.classList.add('active');state.selectedGlass = btn.dataset.type;createGlasses();});});// Resizewindow.addEventListener('resize', onResize);}function getMousePosition(event) {const rect = renderer.domElement.getBoundingClientRect();mouse.x = ((event.clientX - rect.left) / rect.width) * 2 - 1;mouse.y = -((event.clientY - rect.top) / rect.height) * 2 + 1;}function onMouseDown(event) {getMousePosition(event);raycaster.setFromCamera(mouse, camera);const intersects = raycaster.intersectObjects(glasses, true);if (intersects.length > 0) {isDragging = true;let obj = intersects[0].object;while (obj.parent && !glasses.includes(obj)) {obj = obj.parent;}selectedObject = obj;renderer.domElement.style.cursor = 'grabbing';}}function onMouseMove(event) {if (!isDragging || !selectedObject) return;getMousePosition(event);raycaster.setFromCamera(mouse, camera);const plane = new THREE.Plane(new THREE.Vector3(0, 0, 1), 0);const point = new THREE.Vector3();raycaster.ray.intersectPlane(plane, point);if (point) {selectedObject.position.x = point.x;selectedObject.position.z = point.z;// Check for collisionif (checkCollision()) {handleClink();}}}function onMouseUp() {isDragging = false;selectedObject = null;renderer.domElement.style.cursor = 'grab';}function onTouchStart(event) {event.preventDefault();if (event.touches.length === 1) {const touch = event.touches[0];onMouseDown({ clientX: touch.clientX, clientY: touch.clientY });}}function onTouchMove(event) {event.preventDefault();if (event.touches.length === 1) {const touch = event.touches[0];onMouseMove({ clientX: touch.clientX, clientY: touch.clientY });}}function onTouchEnd() {onMouseUp();}function onResize() {camera.aspect = window.innerWidth / window.innerHeight;camera.updateProjectionMatrix();renderer.setSize(window.innerWidth, window.innerHeight);}function animate() {requestAnimationFrame(animate);// Update particlesparticles = particles.filter(particle => {particle.position.add(particle.userData.velocity);particle.userData.life -= 0.02;particle.material.opacity = particle.userData.life * 0.6;if (particle.userData.life <= 0) {scene.remove(particle);return false;}return true;});// Update confetticonfetti = confetti.filter(confetto => {confetto.position.add(confetto.userData.velocity);confetto.rotation.x += confetto.userData.rotationSpeed.x;confetto.rotation.y += confetto.userData.rotationSpeed.y;confetto.userData.life -= 0.01;if (confetto.position.y < 0 || confetto.userData.life <= 0) {scene.remove(confetto);return false;}return true;});// Glass physicsglasses.forEach(glass => {if (!isDragging || glass !== selectedObject) {// Apply velocityglass.position.add(glass.userData.velocity);// Frictionglass.userData.velocity.multiplyScalar(0.95);// Spring back to original positionconst dx = glass.userData.originalPos.x - glass.position.x;const dz = glass.userData.originalPos.z - glass.position.z;glass.userData.velocity.x += dx * 0.02;glass.userData.velocity.z += dz * 0.02;// Wobble animationglass.rotation.z = Math.sin(Date.now() * 0.003 + glass.userData.index) * 0.02;glass.rotation.x = Math.cos(Date.now() * 0.002 + glass.userData.index) * 0.01;}});// Decay streakif (Date.now() - state.lastClinkTime > 1000) {state.streak = Math.max(0, state.streak - 0.5);document.getElementById('streakFill').style.width = `${state.streak}%`;}// Decay comboif (Date.now() - state.lastClinkTime > 2000 && state.combo > 0) {state.combo = 0;document.getElementById('combo').classList.remove('active');}renderer.render(scene, camera);}// Initializeinit();</script></body></html>
index.html+919-19