Código em HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bateria</title>
<link href="" rel="" integrity="" crossorigin="">
</head>
<style>
.battery-top {
width: 30px;
height: 10px;
background: black;
margin: 0 auto;
border: 3px solid silver;
border-top-right-radius: 8px;
border-top-left-radius: 8px;
}
.battery-content {
width: 150px;
height: 250px;
background: black;
position: relative;
margin: 0 auto;
border: 3px solid silver;
border-radius: 18px;
}
.charge {
width: 100%;
position: absolute;
bottom: 0;
border-radius: 14px;
animation: battery 8s linear infinite;
}
@keyframes battery {
0% {
height: 0%;
background: red;
}
25% {
height: 25%;
background: orange;
}
50% {
height: 50%;
background: rgb(7, 195, 241);
}
75% {
height: 75%;
background: blue;
}
100%{
height: 100%;
background: rgb(0, 255, 0);
}
}
</style>
<body>
<div class="main">
<div class="battery-top"></div>
<div class="battery-content">
<div class="charge"></div>
</div>
</body>
</html>