Cara Membuat animasi Bounching bola HTML + CSS

muzadidil


HTML

<!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <link rel="stylesheet" href="style.css"> </head> <body> <div class="wrap"> <div class="loading"> <div class="bounceball"></div> <div class="text">WWW.AEMITRA.ID....</div> </div> </div> </body> </html>

CSS

@import url(https://fonts.googleapis.com/css?family=Montserrat); body { position: relative; width: 100%; height: 100vh; font-family: Montserrat; } .wrap { position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); } .text { color: #fbae17; display: inline-block; margin-left: 5px; } .bounceball { position: relative; display: inline-block; height: 37px; width: 15px; } .bounceball:before { position: absolute; content: ''; display: block; top: 0; width: 15px; height: 15px; border-radius: 50%; background-color: #fbae17; -webkit-transform-origin: 50%; transform-origin: 50%; -webkit-animation: bounce 500ms alternate infinite ease; animation: bounce 500ms alternate infinite ease; } @-webkit-keyframes bounce { 0% { top: 30px; height: 5px; border-radius: 60px 60px 20px 20px; -webkit-transform: scaleX(2); transform: scaleX(2); } 35% { height: 15px; border-radius: 50%; -webkit-transform: scaleX(1); transform: scaleX(1); } 100% { top: 0; } } @keyframes bounce { 0% { top: 30px; height: 5px; border-radius: 60px 60px 20px 20px; -webkit-transform: scaleX(2); transform: scaleX(2); } 35% { height: 15px; border-radius: 50%; -webkit-transform: scaleX(1); transform: scaleX(1); } 100% { top: 0; } }
muzadidil
Intovert, Cepat beradaptasi, simple, Fokus, Cenderung Lebih suka makan daripada Minum.
Komentar