js+css模拟时钟显示当前时间指针走动效果代码

代码语言:html

所属分类:其他

代码描述:js+css模拟时钟显示当前时间指针走动效果代码

代码标签: js css 模拟 时钟 显示 当前 时间 指针 走动

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

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

<head>
  <meta charset="UTF-8">
  

  
  
  
<style>
body {
  background-color: black;
  color: white;
}
.clock {
  width: 90vh;
  height: 90vh;
  border: 1px solid #333;
  border-radius: 50%;
  position: relative;
  margin: 50px auto;
  background-image: url(//repo.bfw.wiki/bfwrepo/images/clock/quadrante-scuro.png);
  background-size: cover;
  background-position: center;
  box-shadow: 0px 4px 5px 2px rgb(0 0 0 / 50%);
}

.hand {
  width: 45%;
  margin-left: 5%;
  height: 6px;
  background-color: #333;
  position: absolute;
  top: 50%;
  transform-origin: 100%;
  transform: rotate(90deg);
  filter: drop-shadow(5px 0px 5px black);
}
.hour-hand {
  z-index: 3;
  height: 16%;
  background-image: url(//repo.bfw.wiki/bfwrepo/images/clock/ore9.png);
  background-size: contain;
  background-repeat: no-repeat;
  background-color: transparent;
  background-position-y: -0px;
  background-position-x: 100%;
  top: 42%;
}
.minute-hand {
  z-index: 2;
  height: 11%;
  background-image: url(//repo.bfw.wiki/bfwrepo/images/clock/minuti9.png);
  background-size: contain;
  background-repeat: no-repeat;
  background-color: transparent;
  background-position-y: 50%;
  background-position-x: 0px;
  top: 44.5%;
  left: 0%;
}
.second-hand {
  z-index: 4;
  background-color: red;
  height: 2px;
}
.center-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  height: 3%;
  width: 3%;
  background-color: red;
  border-radius: 50%;
  z-index: 10;
}
.bla-bla-bla {
  width: 600px;
  margin: auto;
  font-size: 20px;
  text-align: center;
}
</style>


  
</head>

<body >
  <div class="clock">
  <div class="hand hour-hand"></div>
  <div class="hand minute-hand"></div>
  <div class="hand second-hand">.........完整代码请登录后点击上方下载按钮下载查看

网友评论0