js模仿苹果手机秒表计时效果代码

代码语言:html

所属分类:动画

代码描述:js模仿苹果手机秒表计时效果代码

代码标签: 手机 秒表 计时 效果

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


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

<head>

  <meta charset="UTF-8">
  

  
  
  
<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  min-height: 100vh;
  background: rgb(210, 252, 243);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  font-weight: 100;
}

.container {
  height: 620px;
  width: 300px;
  background: white;
  position: relative;
  border-radius: 50px;
  box-shadow: 0px 2px 20px rgba(19, 19, 19, 0.2);
}

.container-upper {
  position: absolute;
  height: 5px;
  width: 70px;
  top: 40px;
  background: #111111;
  border-radius: 10px;
  left: 50%;
  transform: translateX(-50%);
}

.container-upper:before {
  position: absolute;
  content: "";
  height: 9px;
  width: 9px;
  left: -20px;
  background: #111111;
  border-radius: 50%;
  top: 50%;
  transform: translateY(-50%);
}

.container-lower {
  position: absolute;
  height: 50px;
  width: 50px;
  bottom: 15px;
  border-radius: 50%;
  left: 50%;
  transform: translateX(-50%);
  border: 1px solid #111111;
}

.face {
  position: absolute;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  background: #111111;
  height: 73%;
  width: 93%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 1.7em;
}

.screen {
  width: 100%;
  padding: 10px;
}

.timer {
  font-weight: 100;
  font-size: 2.4em;
}

.controls {
  display: flex;
  justify-content: space-between;
  margin: 50px 0px 10px 0px;
  align-items: center;
}

.controls button {
  border-radius: 50%;
  width: 60px;
  height: 60px;
  border: none;
  position: relative;
  font-size: 0.5em;
  cursor: pointer;
  transition: all 0.3s ease;
}

.controls button:hover {
  filter: opacity(0.8);
}

.controls button:before {
  border-radius: 50%;
  width: 90%;
  height: 90%;
  border: 2px solid #111111;
  position: absolute;
  content: "";
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.controls .reset-btn {
  display: none;
}

.controls .reset-btn,
.lap-btn {
  background: rgb(94, 94, 94);
  color: #fff;
}

.controls .start-btn {
  background: rgb(2, 36, 2);
  color: lawngreen;
}

.controls .pause-btn {
  display: none;
  background: rgb(63, 1, 6);
  color: red;
}

.slider {
  width: 25px;
  height: 6px;
  position: relative;
}

.slider:before,
.slider:after {
  content: "";
  height: 100%;
  width: 6px;
  top: 0;
  position: absolute;
  border-radius: 50%;
}

.slider:before {
  left: 0;
  background: #fff;
}

.slider:after {
  right: 0;
  background: rgb(94, 94, 94);
}

.tracker-wrapper {
  height: 90px;
  overflow: scroll;
  cursor: pointer;
  position: relative;
  border-top: 1px solid rgb(94, 94, 94);
  margin: 15px 0 -70px 0;
}

.end-of-list {
  background: red;
  width: 100px;
  bottom: 0;
  height: 50px;
}

.tracker {
  position: absolute;
  top: 0;
  min-height: 200px;
  width: 100%;
  overflow: scroll;
  background: repeating-linear-gradient(
    #111,
    #111 30px,
    rgb(94, 94, 94) 30px,
    rgb(94, 94, 94) 31px
  );
}

.tracker .lap-data {
  height: 31px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tracker .lap-data span {
  font-size: 0.5em;
  flex: 7;
}

.tracker .lap-data span:nth-of-type(2) {
  font-size: 0.5em;
  width: 100%;
  flex: 2;
}

.toolbar-upper {
  position: absolute;
  width: 100%;
  height: 20px;
  top: 0;
  background: rgb(34, 31, 31);
  left: 0;
  display: flex;
  justify-content: space-between;
  font-size: 0.35em;
  align-items: center;
  padding: 0 10px;
}

.toolbar-lower {
  position: absolute;
  width: 100%;
  height: 40px;
  border-top: 1px solid rgb(43, 42, 42);
  bottom: 0;
  left: 0;
  background: rgb(34, 31, 31);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
}

.toolbar-lower-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: rgb(150, 146, 146);
  cursor: pointer;
}

.toolbar-lower-item.active {
  color: rgb(255, 182, 72);
}

.toolbar-lower-item span {
  font-size: 0.35em;
}

.toolbar-lower-item i {
  font-size: 0.65em;
}
</style>


</head>

<body>
  <div class="container">
  <div class="container-upper"></div>
     <div class="face">
        <div class="toolbar-upper">
          <div class="toolbar-upper-item">
            <i class="fas fa-signal"></i>
            <span>chatr</span>
            <i class="fas fa-wifi"></i>
          </div>
          <div class="toolbar-upper-item">
            <span id="local-time"></span>
          </div>
          <div class="toolbar-upper-item">
            <span>38%</span>
            <i class="fas fa-battery-quarter"></i>
          </div>
        </div>
        <div class="screen">
          <div class="timer-wrapper">
            <h1 class="timer">00:00.00</h1>
          </div>
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0