html设计(两种常见的充电效果)

第一种

完整代码:

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>
    <style>
        *{
padding: 0;
margin: 0;
}
.box{
width: 800px;
height: 800px;
background-color: black;
margin: 20px auto;
padding-top: 20px;
position: relative;
}
.battery{
width: 200px;
height: 320px;
background-color:white;
margin-top: 200px;
margin-left: 300px;
border-radius: 15px 15px 0px 0px;
position: relative;
/* top: 20px; */
}
.battery::before{
content: "";
width: 50px;
height: 20px;
background-color:white;
position: absolute;
top: -20px;
left: 38%;
}
.battery::after{
content: "";
position: absolute;
top: 90%;
left: 0;
right: 0;
bottom: 0;
background-image: linear-gradient(to bottom,#7abcff 0%,#00BCD4
44%,#2196F3 100%);
animation:change 10s linear infinite ;
}
@keyframes change{
0%{
top: 100%;
filter: hue-rotate(90deg);
}
95%{
top: 5%;
border-radius: 0;
}
100%{
top: 0%;
border-radius: 15px 15px 0px 0px;
filter: hue-rotate(0deg);
}
}
.cover{
width: 100%;
height: 100%;
/* background-color: #00BCD4; */
border-radius: 15px 15px 0px 0px;
position: absolute;
top: 0;
left: 0;
z-index: 1;
overflow: hidden;
}
.cover::before{
content: "";
width: 400px;
height: 400px;
background-color: rgba(255, 255, 255, 0.8);
position: absolute;
left: -50%;
border-radius: 42% 40%;
animation: coverBefore 10s linear infinite;
}
@keyframes coverBefore{
0%{
transform: rotate(0deg);
bottom: 0%;
}
100%{
transform: rotate(360deg);
bottom: 100%;
}
}
.cover::after{
content: "";
width: 400px;
height: 400px;
background-color: rgba(255, 255, 255, 0.7);
position: absolute;
left: -50%;
border-radius: 42% 40%;
animation: coverAfter 10s linear infinite;
}
@keyframes coverAfter{
0%{
transform: rotate(30deg);
bottom: 2%;
}
100%{
transform: rotate(360deg);
bottom: 95%;
}
}
    </style>
</head>
<body>
    <div class="box">
    <div class="battery">
    <div class="cover"></div>
</body>
</html>

第二种

完整代码:

html 复制代码
<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>充电效果</title>

<style>

*{

padding: 0;

margin: 0;

}

/* .box{

width: 1000px;

height:1000px;

background-color: black;

margin: 20px auto;

padding-top: 20px;

position: relative;

} */

.contrast{

width: 70%;

height: 70%;

background-color:black;

position: absolute;

top: 20px;

left: 20%;

filter: contrast(15);

animation: hueRotate 5s linear infinite;

}

@keyframes hueRotate{

0%{

filter: contrast(15) hue-rotate(0);

}

100%{

filter: contrast(15) hue-rotate(360deg);

}

}

.circle{

width: 300px;

height: 300px;

/* background-color: #2196F3; */

position: absolute;

top: 0;

left: 50%;

margin-left: -150px;

filter: blur(8px);

animation: circleRotate 5s linear infinite;

}

@keyframes circleRotate{

0%{

transform: rotate(0);

}

100%{

transform: rotate(360deg);

}

}

.circle::before{

content: "";

width: 200px;

height: 200px;

background-color: #00ff6f;

position: absolute;

top: 50%;

left: 50%;

border-radius: 42% 38% 64% 49%/45%;

transform: translate(-50%,-50%);

}

.circle::after{

content: "";

width: 180px;

height: 178px;

background-color: black;

position: absolute;

top: 50%;

left: 50%;

border-radius: 50%;

transform: translate(-50%,-50%);

}

.number{

width: 200px;

height: 200px;

color: white;

font-size: 30px;

position: absolute;

top: 9%;

left: 55%;

z-index: 1;

line-height: 200px;

text-align: center;

margin-left: -100px;

}

.bubble_home{

width: 150px;

height: 50px;

background-color: #00ff6f;

position: absolute;

bottom: 0;

left: 45%;

border-radius: 150px 150px 15px 15px;

filter: blur(8px);

}

.bubble{

/* width: 20px;

height: 20px;

background-color:#00ff6f;

border-radius: 100%; */

position: absolute;

left: 50%;

bottom: 0;

z-index: 1;

animation:bubbleMoveUp 5s ease-in-out infinite ;

}

@keyframes bubbleMoveUp{

0%{

bottom: 0;

}

100%{

bottom: calc(100% - 260px);

}

}

.bubble:nth-child(1){

width: 20px;

height: 20px;

background-color:#00ff6f;

border-radius: 100%;

animation-duration: 5s;

animation-delay: 1s;

left: 50%;

}

.bubble:nth-child(2){

width: 18px;

height: 18px;

background-color:#00ff6f;

border-radius: 100%;

animation-duration: 7s;

animation-delay: 3s;

left: 47%;

}

.bubble:nth-child(3){

width: 22px;

height: 22px;

background-color:#00ff6f;

border-radius: 100%;

animation-duration: 3s;

animation-delay: 0.5s;

left: 51%;

}

.bubble:nth-child(4){

width: 18px;

height: 18px;

background-color:#00ff6f;

border-radius: 100%;

animation-duration: 4s;

animation-delay: 0s;

left: 50%;

}

.bubble:nth-child(5){

width: 20px;

height: 18px;

background-color:#00ff6f;

border-radius: 100%;

animation-duration: 7.5s;

animation-delay: 3.6s;

left: 48%;

}

.bubble:nth-child(6){

width: 21px;

height: 21px;

background-color:#00ff6f;

border-radius: 100%;

animation-duration: 8s;

animation-delay: 1.5s;

left: 50%;

}



</style>

</head>

<body>

<div class="box">

</div>

<div class="number">95.3%</div>

<div class="contrast">

<div class="bubble"></div>

<div class="bubble"></div>

<div class="bubble"></div>

<div class="bubble"></div>

<div class="bubble"></div>

<div class="bubble"></div>

<div class="bubble"></div>

<div class="bubble"></div>

<div class="bubble"></div>

<div class="bubble"></div>

<div class="bubble"></div>

<div class="bubble"></div>

<div class="bubble"></div>

<div class="bubble"></div>

<span class="bubble_home"></span>

<div class="circle"></div>

</div>

</div>

</body>

</html>
相关推荐
Json_181790144801 小时前
电商拍立淘按图搜索API接口系列,文档说明参考
前端·数据库
风尚云网1 小时前
风尚云网前端学习:一个简易前端新手友好的HTML5页面布局与样式设计
前端·css·学习·html·html5·风尚云网
木子02041 小时前
前端VUE项目启动方式
前端·javascript·vue.js
GISer_Jing1 小时前
React核心功能详解(一)
前端·react.js·前端框架
捂月1 小时前
Spring Boot 深度解析:快速构建高效、现代化的 Web 应用程序
前端·spring boot·后端
深度混淆2 小时前
实用功能,觊觎(Edge)浏览器的内置截(长)图功能
前端·edge
Smartdaili China2 小时前
如何在 Microsoft Edge 中设置代理: 快速而简单的方法
前端·爬虫·安全·microsoft·edge·社交·动态住宅代理
秦老师Q2 小时前
「Chromeg谷歌浏览器/Edge浏览器」篡改猴Tempermongkey插件的安装与使用
前端·chrome·edge
滴水可藏海2 小时前
Chrome离线安装包下载
前端·chrome
m51272 小时前
LinuxC语言
java·服务器·前端