div+css+js实现指针走动显示时间的简洁时钟效果代码

代码语言:html

所属分类:布局界面

代码描述:div+css+js实现指针走动显示时间的简洁时钟效果代码

代码标签: div css js 指针 走动 显示 时间 简洁 时钟

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

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

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

  
  
<style>
html,
body {
  background: white;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}

.clock {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: black;
  width: 250px;
  height: 250px;
  border-radius: 50%;
}

.hands {
  position: relative;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
}

.hour,
.minute,
.second {
  position: absolute;
  left: 0;
  bottom: 0;
  right: 0;
  transform: rotate(0deg);
  transform-origin: bottom center;
  width: 4px;
  border-radius: 2px;
}

.hour {
  background: white;
  height: 50px;
  top: -20%;
}

.minute {
  background: white;
  height: 90px;
  top: -36%;
}

.second {
  background: #ff0f7b;
  width: 2px;
  height: 80px;
  top: -32%;
}

.clock:before {
  content: "";
  z-index: -1;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(-45deg, #f89b29 0%, #ff0f7b 100%);
  transform: translate3d(0, 20px, 0) scale(1.2);
  filter: blur(40px);
  opacity: var(0.8);
  transition: opacity 0.3s;
  border-radius: inherit;
  -webkit-animation: blobby 5s infinite ease;
          animation: blobby 5s infinite ease;
}

.clock:after {
  content: "";
  z-index: -1;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: inherit;
  border-radius: inherit;
}

@-webkit-keyframes blobby {
  0% {
    transform: translate3d(0px, 20px, 0) scale(1.2);
  }
  20% {
    .........完整代码请登录后点击上方下载按钮下载查看

网友评论0