🍀소스코드
<!DOCTYPE html>
<html lang="en">
<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 Animation</title>
<style>
body {
display: flex;
align-items: center;
justify-content: center;
background: #0c0c0c;
height: 100vh;
margin: 0;
}
.container {
display: flex;
align-items: center;
overflow: hidden;
height: 50vh;
width: 50%;
}
.pacman {
position: relative;
background: transparent;
z-index: 1;
}
.pacman::before,
.pacman::after {
position: absolute;
top: -35px;
display: block;
border-radius: 50%;
content: "";
height: 0px;
width: 0px;
}
.pacman::before {
animation: chunk-top 1s ease infinite; /* 시간 수정 */
border: 35px solid #FFCC00;
border-left-color: transparent;
border-bottom-color: transparent;
}
.pacman::after {
animation: chunk-bottom 1s ease infinite; /* 시간 수정 */
border: 35px solid #FFCC00;
border-right-color: transparent;
border-top-color: transparent;
}
.path {
display: flex;
justify-content: space-around;
animation: eating-path 2s linear infinite; /* 시간 수정 */
width: 100%;
}
.path::before {
background: #fff;
border-radius: 50%;
content: "";
height: 1rem;
width: 1rem;
}
@keyframes chunk-top {
0%, 100% {
transform: rotate(-45deg);
}
50% {
transform: rotate(-80deg);
}
}
@keyframes chunk-bottom {
0%, 100% {
transform: rotate(-40deg);
}
50% {
transform: rotate(0deg);
}
}
@keyframes eating-path {
0% {
transform: translateX(50%);
}
100% {
transform: translateX(-50%);
}
}
</style>
</head>
<body>
<div class="container">
<div class="pacman"></div>
<div class="path"></div>
</div>
</body>
</html>