js+css实现aqi颗粒物环形指数数值变动动画效果代码
代码语言:html
所属分类:动画
代码描述:js+css实现aqi颗粒物环形指数数值变动动画效果代码
代码标签: js css aqi 颗粒物 环形 指数 数值 变动 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
:root {
--primary-bg: #1e203a;
--meter-bg-colors:conic-gradient(
from 0deg,
rgba(0, 222, 114, 1),
rgba(255, 226, 28, 1),
rgba(255, 141, 6, 1),
rgba(251, 42, 63, 1),
rgba(178, 1, 238, 1),
rgba(109, 9, 25, 1)
);
--primary-color: whitesmoke;
}
/*Custom Font Import*/
@font-face {
font-family: "clockDigital";
src: url("//repo.bfw.wiki/bfwrepo/font/digital-7.woff2") format("woff2"),
url("//repo.bfw.wiki/bfwrepo/font/digital-7.woff") format("woff");
}
/*CSS RESET*/
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "clockDigital";
}
/*Background properties*/
#bg {
height: 100vh;
background-color: var(--primary-bg);
display: grid;
place-items: center;
}
/*U.S.AQI meter using (EPA)category colors*/
#meter {
position: relative;
height: 200px;
aspect-ratio: 1/1;
border-radius: 100%;
background:var(--meter-bg-colors);
display: grid;
place-items: center;
}
/*Inner body of meter*/
#meter:before {
position: absolute;
content: " ";
padding: 90px;
padding: 90px;
border-radius: 100%;
background: var(--primary-bg);
}
/*
the container for the indicator/dot to position it properly
and add a slight transition for the calculation formula in JS
*/
#indicator {
position: absolute;
height: 205px;
aspect-ratio: 1/1;
transition:.2s;
display: flex;
justify-content: center;
rotate: 5deg;
/*animation:spin 5s linear alternate infinite;*/
}
/*The dot on the meter to indicate meters AQI level*/
#indicator:before {
position: absolute;
content: " ";
padding: 5px;
background: var(--primary-color);
top: 0;
border-radius: 100%;
border: 3px solid var(--primary-bg);
}
/*AQI number*/
#current-aqi {
position: absolute;
letter-spacing: 1px;
font-size: 70px;
color: var(--primary-color);
text-align: center;
line-height: 20px;
}
/*SVG and AQI text*/
p {
font-size: 20px;
color: #999;
position: absolute;
top: 130px;
display: flex;
align.........完整代码请登录后点击上方下载按钮下载查看
网友评论0