css实现逼真氛围灯变化发光键盘点击按下效果代码

代码语言:html

所属分类:布局界面

代码描述:css实现逼真氛围灯变化发光键盘点击按下效果代码

代码标签: css 逼真 氛围灯 变化 发光 键盘 点击 按下

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开


<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8">


<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/reset.min.css">
  
  
<style>
body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #222;
  background: linear-gradient(to bottom left, #2a2a2a, #1a1a1a);
  font-family: system-ui;
}

.keyborad {
  --radius: 4vmin;
  --red: rgb(255, 100, 100);
  --green: rgb(100, 200, 100);
  --blue: rgb(100, 100, 255);
  background-color: #111;
  padding: 2vmin;
  border-radius: var(--radius);
  box-shadow: 0 4vmin #0b0b0b, -2vmin 5vmin 4vmin #0a0a0a;
  position: relative;
  box-sizing: border-box;
}
.keyborad:after {
  content: "";
  height: 100vh;
  width: 1.2vw;
  bottom: 100%;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(to left, #111, #222, #111, #111);
  box-shadow: -0.4vmin 0 1vmin #111;
}
.keyborad:before {
  content: "@andreuscafe";
  position: absolute;
  top: calc(100% + 1.2vmin);
  left: 0;
  width: 100%;
  text-align: center;
  color: #3a3a3a;
  font-size: 1.5vmin;
}
.keyborad .keyboadr-inner {
  display: flex;
  gap: 1vmin;
  padding: 0.75vmin 1vmin 1vmin;
  overflow: hidden;
  background-color: #222;
  border-radius: calc(var(--radius) * 0.5);
  box-shadow: 0 0.5vmin black inset;
}
.keyborad .keyboadr-inner .key {
  width: 10vmin;
  height: 9vmin;
  padding: 0.6vmin 0.6vmin 0.9vmin;
  top: 0.5vmin;
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--radius) * 0.5);
  transform: translate3d(0, 0, 0);
  -webkit-animation: shadow 5s -0.5s linear infinite;
          animation: shadow 5s -0.5s linear infinite;
  --delay: 0;
}
.keyborad .keyboadr-inner .key:nth-child(1n+1) {
  --delay: 0.2s;
  -webkit-animation: shadow 5s calc(-0.5s + var(--delay)) linear infinite;
          animation: shadow 5s calc(-0.5s + var(--delay)) linear infinite;
}
.keyborad .keyboadr-inner .key:nth-child(1n+1) .key-cotnent {
  -webkit-animation: color 5s calc(-0.5s + var(--delay)) linear infinite;
          animation: color 5s calc(-0.5s + var(--delay)) linear infinite;
}
.keyborad .keyboadr-inner .key:nth-child(1n+2) {
  --delay: 0.4s;
  -webkit-animation: shadow 5s calc(-0.5s + var(--delay)) linear infinite;
          animation: shadow 5s calc(-0.5s + var(--delay)) linear infinite;
}
.keyborad .keyboadr-inner .key:nth-child(1n+2) .key-cotnent {
  -webkit-animation: color 5s calc(-0.5s + var(--delay)) linear infinite;
          animation: color 5s calc(-0.5s + var(--delay)) linear infinite;
}
.keyborad .keyboadr-inner .key:nth-child(1n+3) {
  --delay: 0.6s;
  -webkit-animation: shadow 5s calc(-0.5s + var(--delay)) linear infinite;
          animation: shadow 5s calc(-0.5s + var(--delay)) linear infinite;
}
.keyborad .keyboadr-inner .key:nth-child(1n+3) .key-cotnent {
  -webkit-animation: color 5s calc(-0.5s + var(--delay)) linear infinite;
          animation: color 5s calc(-0.5s + var(--delay)) linear infinite;
}
.keyborad .keyboadr-inner .key:nth-child(1n+4) {
  --delay: 0.8s;
  -webkit-animation: shadow 5s calc(-0.5s + var(--delay)) linear infinite;
          animation: shadow 5s calc(-0.5s + var(--delay)) linear infinite;
}
.keyborad .keyboadr-inner .key:nth-child(1n+4) .key-cotnent {
  -webkit-animation: color 5s calc(-0.5s + var(--delay)) linear infinite;
          animation: color 5s calc(-0.5s + var(--delay)) linear infinite;
}
.keyborad .keyboadr-inner .key:nth-child(1n+5) {
  --delay: 1s;
  -webkit-animation: shadow 5s calc(-0.5s + var(--delay)) linear infinite;
          animation: shadow 5s calc(-0.5s + var(--delay)) linear infinite;
}
.keyborad .keyboadr-inner .key:nth-child(1n+5) .key-cotnent {
  -webkit-animation: color 5s calc(-0.5s + var(--delay)) linear infinite;
          animation: color 5s calc(-0.5s + var(--delay)) linear infinite;
}
.keyborad .keyboadr-inner .key:nth-child(1n+6) {
  --delay: 1.2s;
  -webkit-animation: shadow 5s calc(-0.5s + var(--delay)) linear infinite;
          animation: shadow 5s calc(-0.5s + var(--delay)) linear infinite;
}
.keyborad .keyboadr-inner .key:nth-child(1n+6) .key-cotnent {
  -webkit-animation: color 5s calc(-0.5s + var(--delay)) linear infinite;
          animation: color 5s calc(-0.5s + var(--delay)) linear infinite;
}
.keyborad .keyboadr-inner .key:nth-child(1n+7) {
  --delay: 1.4s;
  -webkit-animation: shadow .........完整代码请登录后点击上方下载按钮下载查看

网友评论0