炫酷灯泡打开关闭效果
代码语言:html
所属分类:动画
代码描述:炫酷灯泡打开关闭效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
/* Press the light bulb button using either a mouse or a keyboard, touch works too! to change the theme :) */
/* DEFAULTS */
/* ======================================================= */
body {
--global-bg: hsl(222 4% 96%);
--global-s: hsl(222 99% 46%);
--global-l: hsl(222 22% 92%);
--global-bs: transparent;
}
body.on {
--global-bg: hsl(228 100% 4%);
--global-s: hsl(254 100% 83%);
--global-l: hsl(254 2% 18%);
--global-bs: hsl(146 100% 84% / .06);
}
body {
display: grid;
place-content: center;
min-height: 100vh;
padding: 20px;
box-sizing: border-box;
margin: 0;
background: var(--global-bg);
-webkit-transition: .3s linear;
transition: .3s linear;
}
/* BUTTON */
/* ======================================================= */
button {
width: 200px;
height: 200px;
border-radius: 1000px;
padding: 2rem;
box-sizing: content-box;
display: -webkit-box;
display: flex;
-webkit-box-pack: center;
justify-content: center;
-webkit-box-align: center;
align-items: center;
border: 2px solid var(--global-l);
background: transparent;
cursor: pointer;
-webkit-transition: .3s;
transition: .3s;
margin: 0 auto;
}
button:focus {
outline: 0;
border-color: var(--global-s);
}
button:active {
-webkit-transform: scale(.92);
transform: scale(.92);
}
/* LIGHT BULB */
/* ======================================================= */
.light-bulb {
--t-duration: .3s;
--t-type: linear;
pointer-events: none;
-webkit-transform: translateY(9px);
transform: translateY(9px);
}
.upper {
-webkit-transform: translateY(-11px);
transform: translateY(-11px);
}
.circle {
width: 56px;
height: 54px;
background: inherit;
border: 2px solid var(--global-s);
border-radius: 100px;
position: relative;
-webkit-transiti.........完整代码请登录后点击上方下载按钮下载查看
网友评论0