d3实现概念时钟指示效果

代码语言:html

所属分类:动画

代码描述:d3实现概念时钟指示效果

代码标签: 时钟 指示 效果

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

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<style>
body {
  background: #454555;
}

.polar-gantt {
  width: 320px;
  height: 320px;
  margin: 20px auto 0;
}
.polar-gantt svg {
  width: 100%;
  height: 100%;
}
.polar-gantt svg .hours-hand,
.polar-gantt svg .minutes-hand,
.polar-gantt svg .seconds-hand {
  stroke-linecap: round;
  stroke: rgba(255, 255, 255, 0.5);
}
.polar-gantt svg .hours-hand {
  stroke-width: 3;
}
.polar-gantt svg .minutes-hand {
  stroke-width: 2;
}
.polar-gantt svg .seconds-hand {
  stroke-width: 1;
}
.polar-gantt svg .hands-cover {
  fill: #fff;
}
.polar-gantt svg .hours-tick {
  stroke: #fff;
}
.polar-gantt svg .hours-label {
  font-size: 10px;
  fill: rgba(255, 255, 255, 0.5);
}
</style>

</head>
<body translate="no">

<div class="polar-gantt">
<div id="target" ></div>
</div>

<script type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/d3.v3.js"></script>

<script>
console.clear();

class PolarGantt {
  constructor() {
    this.radians = Math.PI / 180;
  }

  init(opt) {
    let container = d3.select(opt.sel),
    measures = container.node().getBoundingClientRect(),
    t = new Date();

    this.clockRadius = measures.width * 0.8 / 2;
    this.margin = measures.width * 0.2 / 4;
    this.width = (this.clockRadius + this.marg.........完整代码请登录后点击上方下载按钮下载查看

网友评论0