js+svg实现数字时钟显示时间效果代码

代码语言:html

所属分类:其他

代码描述:js+svg实现数字时钟显示时间效果代码

代码标签: js svg 数字 时钟 显示 时间

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

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

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

  
  
  
<style>
body {
	background: #111;
}
#clock {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: calc(100vw - 4px);
	max-width: 300px;
}
</style>



  
  
</head>

<body>
  <div id="clock"></div>

      <script>
// this function creates the SVG and appends it to the element you give to it
function initClock(elt, color = '#0ff', backgroundColor = 'none') {
	let timeObj = {
		numberPathsD: {
			topM: "M 8 4 L 16 4 L 18 6 L 16 8 L 8 8 L 6 6 Z",
			midd: "M 8 18 L 16 18 L 18 20 L 16 22 L 8 22 L 6 20 Z",
			topL: "M 6 7 L 8 9 L 8 17 L 6 19 L 4 17 L 4 9 Z",
			topR: "M 18 7 L 20 9 L 20 17 L 18 19 L 16 17 L 16 9 Z",
			btmM: "M 8 32 L 16 32 L 18 34 L 16 36 L 8 36 L 6 34 Z",
			btmL: "M 6 21 L 8 23 L 8 31 L.........完整代码请登录后点击上方下载按钮下载查看

网友评论0