비전공자 개발일기

Pac-man Loader 본문

HTML _CSS

Pac-man Loader

HiroDaegu 2023. 1. 24. 17:38
728x90
SMALL

<!DOCTYPE html>
<html lang="ko">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>PACMAN LOADER</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div class="pac-man"></div>
</body>
</html>
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #333;
}

.pac-man {
    border-radius: 100em 100em 0 0 ;
    transform-origin: bottom;
    animation: easing-top .5s infinite;
}

.pac-man, .pac-man::before {
    width: 70px;
    height: calc(70px / 2);
    background-color: #FED75A;
}

.pac-man::before {
    content: "";
    display: block;
    margin-top: calc(70px / 2);
    position: absolute;
    transform-origin: top;
    border-radius: 0 0 100em 100em;
    transform: rotate(80deg);
    animation: easing-bottom .5s infinite;
}

.pac-man::after {
    content: "";
    position: absolute;
    border-radius: 100em;
    display: block;
    width: 20px;
    height: 20px;
    margin-top: calc((70px / 2 ) - 10px);
    margin-left: calc((70px / 2 ) - 10px);
    transform-origin: center;
    animation: centers 0.5s infinite, ball 0.5s infinite linear;
}

@keyframes easing-top {
    0%, 100% {
        transform: rotate(-40deg);
    }
    50% {
        transform: rotate(0);
    }
}

@keyframes easing-bottom {
    0%, 100% {
        transform: rotate(80deg);
    }
    50% {
        transform: rotate(0);
    }
}

@keyframes centers {
    0%, 100% {
        transform: rotate(40deg);
    }
    50% {
        transform: rotate(0);
    }
}

@keyframes ball {
    0% {
      opacity: 0.7;
      box-shadow: 70px 0 0 0 #FED75A, 120px 0 0 0 #FED75A, 170px 0 0 0 #FED75A,
        220px 0 0 0 #FED75A;
    }
  
    100% {
      box-shadow: 20px 0 0 0 #FED75A, 70px 0 0 0 #FED75A, 120px 0 0 0 #FED75A,
        170px 0 0 0 #FED75A;
    }
  }
728x90
LIST

'HTML _CSS' 카테고리의 다른 글

Ghost Loader  (0) 2023.01.26
3D Spinning Orbits  (0) 2023.01.25
Pendulum Loading  (0) 2023.01.23
Blob Effect Micro Interaction  (0) 2023.01.22
Animated Working Analog Clock  (0) 2023.01.20