please, create a javascript html css beautiful artwork :))) <3
- User
please, create a javascript html css beautiful artwork :))) <3
Assistant
Beautiful Interactive Artwork with JavaScript, HTML, and CSS
Here's a beautiful, interactive artwork that creates a dynamic, colorful particle system that responds to mouse movement. It's a combination of HTML, CSS, and JavaScript that creates a mesmerizing visual experience.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Interactive Particle Art</title> <style> body { margin: 0; padding: 0; overflow: hidden; background: linear-gradient(135deg, #1a1a2e, #16213e); height: 100vh; display: flex; justify-content: center; align-items: center; font-family: 'Arial', sans-serif; color: white; cursor: none; } canvas { display: block; } .title { position: absolute; top: 20px; font-size: 24px; text-shadow: 0 0 10px rgba(255, 255, 255, 0.5); z-index: 10; } .custom-cursor { position: absolute; width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, 0.2); border: 1px solid rgba(255, 255, 255, 0.5); pointer-events: none; z-index: 100; transition: transform 0.1s ease-out; mix-blend-mode: difference; } .custom-cursor::before { content: ''; position: absolute; width: 100%; height: 100%; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0) 70%); opacity: 0.5; } </style> </head> <body> <div class="title">Interactive Particle Art</div> <div class="custom-cursor"></div> <canvas id="artCanvas"></canvas> <script> const canvas = document.getElementById('artCanvas'); const ctx = canvas.getContext('2d'); const cursor = document.querySelector('.custom-cursor'); // Set canvas to full window size canvas.width = window.innerWidth; canvas.height = window.innerHeight; // Particle class class Particle { constructor(x, y, size, color, velocity) { this.x = x; this.y = y; this.size = size; this.color = color; this.velocity = velocity; this.baseX = x; this.baseY = y; this.density = (Math.random() * 30) + 1; this.friction = 0.95; this.ttl = 200; } draw() { ctx.beginPath(); ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2); ctx.fillStyle = this.color; ctx.fill(); ctx.closePath(); } update() { this.ttl--; if (this.ttl <= 0) { this.x = this.baseX; this.y = this.baseY; this.ttl = 200; } // Calculate distance from mouse const dx = mouse.x - this.x; const dy = mouse.y - this.y; const distance = Math.sqrt(dx * dx + dy * dy); // Apply force if close to mouse if (distance < 100) { const forceDirectionX = dx / distance; const forceDirectionY = dy / distance; const force = (100 - distance) / 10; this.x -= forceDirectionX * force * this.density; this.y -= forceDirectionY * force * this.density; } else { // Return to base position if (this.x !== this.baseX) { const dx = this.baseX - this.x; this.x += dx / 10; } if (this.y !== this.baseY) { const dy = this.baseY - this.y; this.y += dy / 10; } } // Apply velocity this.x += this.velocity.x; this.y += this.velocity.y; // Bounce off edges if (this.x + this.size > canvas.width || this.x - this.size < 0) { this.velocity.x = -this.velocity.x; } if (this.y + this.size > canvas.height || this.y - this.size < 0) { this.velocity.y = -this.velocity.y; } this.draw(); } } // Mouse position const mouse = { x: canvas.width / 2, y: canvas.height / 2 }; // Colors const colors = [ '#FF5E78', '#FF9A8B', '#FFD166', '#06D6A0', '#118AB2', '#073B4C', '#EF476F', '#F78C6B' ]; // Create particles const particles = []; const particleCount = 150; function init() { particles.length = 0; for (let i = 0; i < particleCount; i++) { const size = (Math.random() * 3) + 1; const x = Math.random() * canvas.width; const y = Math.random() * canvas.height; const color = colors[Math.floor(Math.random() * colors.length)]; const velocity = { x: (Math.random() - 0.5) * 0.5, y: (Math.random() - 0.5) * 0.5 }; particles.push(new Particle(x, y, size, color, velocity)); } } // Animation loop function animate() { requestAnimationFrame(animate); ctx.clearRect(0, 0, canvas.width, canvas.height); // Draw connecting lines for (let i = 0; i < particles.length; i++) { for (let j = i + 1; j < particles.length; j++) { const dx = particles[i].x - particles[j].x; const dy = particles[i].y - particles[j].y; const distance = Math.sqrt(dx * dx + dy * dy); if (distance < 100) { ctx.beginPath(); ctx.strokeStyle = particles[i].color; ctx.lineWidth = 0.2; ctx.moveTo(particles[i].x, particles[i].y); ctx.lineTo(particles[j].x, particles[j].y); ctx.stroke(); ctx.closePath(); } } } // Update particles particles.forEach(particle => particle.update()); } // Event listeners window.addEventListener('mousemove', (e) => { mouse.x = e.x; mouse.y = e.y; // Update custom cursor position cursor.style.left = `${e.x - 15}px`; cursor.style.top = `${e.y - 15}px`; }); window.addEventListener('resize', () => { canvas.width = window.innerWidth; canvas.height = window.innerHeight; init(); }); // Initialize and start animation init(); animate(); // Add some random particles periodically setInterval(() => { const size = (Math.random() * 3) + 1; const x = Math.random() * canvas.width; const y = Math.random() * canvas.height; const color = colors[Math.floor(Math.random() * colors.length)]; const velocity = { x: (Math.random() - 0.5) * 0.5, y: (Math.random() - 0.5) * 0.5 }; particles.push(new Particle(x, y, size, color, velocity)); // Remove oldest particle if we have too many if (particles.length > particleCount * 1.5) { particles.shift(); } }, 500); </script> </body> </html>Features of this artwork:
- Interactive Particle System: Particles respond to mouse movement with physics-based interactions
- Beautiful Color Palette: A carefully selected color scheme that's pleasing to the eye
- Custom Cursor: A stylish custom cursor that follows your mouse
- Connecting Lines: Particles connect with lines when they're close to each other
- Responsive Design: Adapts to any screen size
- Dynamic Background: A gradient background that enhances the visual effect
- Smooth Animations: All movements are smoothly animated
To use this artwork, simply copy the entire code into an HTML file and open it in a browser. Move your mouse around to interact with the particles!
You can customize it further by:
- Changing the color palette in the
colorsarray - Adjusting the number of particles with
particleCount - Modifying the particle size or behavior in the
Particleclass - Changing the background gradient in the CSS
Enjoy your beautiful interactive artwork! <3
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.