Skip to main content

Loading CSS animation

  

  Loading CSS animation


HTML

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div class="container">
        <img src="ghost.png" class="ghost" alt="">
        <img src="shadow.png" class="shadow" alt="">
    </div>
</body>
</html>


CSS

* {
    margin0;
    padding0;
    box-sizingborder-box;
    background-color#ff4814;
}

.container{
    displayflex;
    flex-directioncolumn;
    height100vh;
    align-itemscenter;
    justify-contentcenter;
}

.ghost{
    margin-bottom5px;
    width20%;
    animation: float 3s ease-out infinite;
}

@keyframes float{
    50%{
        transformtranslate(0,20px);
    }
}

.shadow{
    margin-left15px;
    animation: shrink 3s ease-out infinite;
    transform-origincenter;
}

@keyframes shrink{
    0%, 100%{
        width18%;
    }
    50%{
        width10%;
    }
}





PNG Files

👇👇👇



















































































































Comments