Floating Triangles - MeggiTools
Run
Toggle Theme
Share Link
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Floating Triangles</title> <style> body, html { margin: 0; padding: 0; overflow: hidden; height: 100%; background: #111; } .triangle { position: absolute; width: 0; height: 0; border-left: 20px solid transparent; border-right: 20px solid transparent; border-bottom: 40px solid #ff00ff; animation: float 5s infinite; } @keyframes float { 0% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-20px) rotate(180deg); } 100% { transform: translateY(0) rotate(360deg); } } </style> </head> <body> <script> for (let i = 0; i < 50; i++) { const triangle = document.createElement('div'); triangle.className = 'triangle'; triangle.style.left = `${Math.random() * 100}%`; triangle.style.top = `${Math.random() * 100}%`; triangle.style.animationDuration = `${Math.random() * 5 + 2}s`; document.body.appendChild(triangle); } </script> </body> </html>