Untitled
unknown
plain_text
2 months ago
3.2 kB
3
Indexable
<!DOCTYPE html> <html lang="fr"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Chat Rebondissant</title> <style> body { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background-color: #00FFFF; /* Fond cyan */ overflow: hidden; /* Empêche les éléments de dépasser de la page */ position: relative; } .chat { width: 150px; height: 150px; background-color: red; /* Couleur de la bulle en rouge */ border-radius: 50%; position: absolute; cursor: pointer; display: flex; justify-content: center; align-items: center; box-shadow: 0 0 10px rgba(255, 0, 0, 0.8); /* Ombre autour du chat pour l'effet */ transition: box-shadow 0.5s ease-out; } .chat:before { content: "🐱"; font-size: 60px; } @keyframes rebond { 0% { transform: translate(0, 0); box-shadow: 0 0 10px rgba(255, 0, 0, 0.8); } 10% { transform: translate(150px, 50px); box-shadow: 0 0 15px rgba(255, 0, 0, 1); } 20% { transform: translate(300px, 100px); box-shadow: 0 0 20px rgba(255, 0, 0, 0.9); } 30% { transform: translate(450px, 200px); box-shadow: 0 0 25px rgba(255, 100, 0, 0.8); } 40% { transform: translate(600px, 250px); box-shadow: 0 0 30px rgba(0, 255, 0, 0.8); } 50% { transform: translate(750px, 100px); box-shadow: 0 0 35px rgba(0, 0, 255, 0.8); } 60% { transform: translate(850px, 50px); box-shadow: 0 0 40px rgba(75, 0, 130, 0.8); } 70% { transform: translate(900px, 150px); box-shadow: 0 0 45px rgba(238, 130, 238, 0.8); } 80% { transform: translate(950px, 300px); box-shadow: 0 0 50px rgba(255, 0, 255, 0.8); } 100% { transform: translate(1000px, 400px); box-shadow: 0 0 55px rgba(255, 0, 0, 0.8); } } .rebond { animation: rebond 5s linear infinite; /* Rebond à travers l'écran sur 5 secondes */ } </style> </head> <body> <div class="chat" onclick="rebondir()"></div> <script> function rebondir() { var chat = document.querySelector('.chat'); chat.classList.add('rebond'); // Retirer l'animation après 5 secondes pour pouvoir la relancer setTimeout(function() { chat.classList.remove('rebond'); }, 5000); // 5 secondes de rebond } </script> </body> </html>
Editor is loading...
Leave a Comment