好看炫酷时钟

炫酷时钟

在这里插入图片描述

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
	</head>
	<body>
		<div id="blogTitle">
		</div>
	</body>
	<script type="text/javascript">
	</script>
	<script>
		// ****************************** 炫酷倒计时 start *********************************
		//可修改位置id
		$("#blogTitle").append("<div></div>");
		
		$("#blogTitle div").css({
			position: "absolute",
			top: 0,
			right: 0
		});
		$("#blogTitle div").attr("id", "pdata");
		$(function() {
			$("#pdata").html('<canvas id="canvas"></canvas>');
			var g = 260;
			var k = 100;
			var j = 1.5;
			var h = 10;
			var n = 0.65;
			var d;
			var b = [];
			const a = ["#33B5E5", "#0099CC", "#AA66CC", "#9933CC", "#99CC00", "#669900", "#FFBB33", "#FF8800", "#FF4444",
				"#CC0000"
			];
			var l = [];
			var m = [
				[
					[0, 0, 1, 1, 1, 0, 0],
					[0, 1, 1, 0, 1, 1, 0],
					[1, 1, 0, 0, 0, 1, 1],
					[1, 1, 0, 0, 0, 1, 1],
					[1, 1, 0, 0, 0, 1, 1],
					[1, 1, 0, 0, 0, 1, 1],
					[1, 1, 0, 0, 0, 1, 1],
					[1, 1, 0, 0, 0, 1, 1],
					[0, 1, 1, 0, 1, 1, 0],
					[0, 0, 1, 1, 1, 0, 0]
				],
				[
					[0, 0, 0, 1, 1, 0, 0],
					[0, 1, 1, 1, 1, 0, 0],
					[0, 0, 0, 1, 1, 0, 0],
					[0, 0, 0, 1, 1, 0, 0],
					[0, 0, 0, 1, 1, 0, 0],
					[0, 0, 0, 1, 1, 0, 0],
					[0, 0, 0, 1, 1, 0, 0],
					[0, 0, 0, 1, 1, 0, 0],
					[0, 0, 0, 1, 1, 0, 0],
					[1, 1, 1, 1, 1, 1, 1]
				],
				[
					[0, 1, 1, 1, 1, 1, 0],
					[1, 1, 0, 0, 0, 1, 1],
					[0, 0, 0, 0, 0, 1, 1],
					[0, 0, 0, 0, 1, 1, 0],
					[0, 0, 0, 1, 1, 0, 0],
					[0, 0, 1, 1, 0, 0, 0],
					[0, 1, 1, 0, 0, 0, 0],
					[1, 1, 0, 0, 0, 0, 0],
					[1, 1, 0, 0, 0, 1, 1],
					[1, 1, 1, 1, 1, 1, 1]
				],
				[
					[1, 1, 1, 1, 1, 1, 1],
					[0, 0, 0, 0, 0, 1, 1],
					[0, 0, 0, 0, 1, 1, 0],
					[0, 0, 0, 1, 1, 0, 0],
					[0, 0, 1, 1, 1, 0, 0],
					[0, 0, 0, 0, 1, 1, 0],
					[0, 0, 0, 0, 0, 1, 1],
					[0, 0, 0, 0, 0, 1, 1],
					[1, 1, 0, 0, 0, 1, 1],
					[0, 1, 1, 1, 1, 1, 0]
				],
				[
					[0, 0, 0, 0, 1, 1, 0],
					[0, 0, 0, 1, 1, 1, 0],
					[0, 0, 1, 1, 1, 1, 0],
					[0, 1, 1, 0, 1, 1, 0],
					[1, 1, 0, 0, 1, 1, 0],
					[1, 1, 1, 1, 1, 1, 1],
					[0, 0, 0, 0, 1, 1, 0],
					[0, 0, 0, 0, 1, 1, 0],
					[0, 0, 0, 0, 1, 1, 0],
					[0, 0, 0, 1, 1, 1, 1]
				],
				[
					[1, 1, 1, 1, 1, 1, 1],
					[1, 1, 0, 0, 0, 0, 0],
					[1, 1, 0, 0, 0, 0, 0],
					[1, 1, 1, 1, 1, 1, 0],
					[0, 0, 0, 0, 0, 1, 1],
					[0, 0, 0, 0, 0, 1, 1],
					[0, 0, 0, 0, 0, 1, 1],
					[0, 0, 0, 0, 0, 1, 1],
					[1, 1, 0, 0, 0, 1, 1],
					[0, 1, 1, 1, 1, 1, 0]
				],
				[
					[0, 0, 0, 0, 1, 1, 0],
					[0, 0, 1, 1, 0, 0, 0],
					[0, 1, 1, 0, 0, 0, 0],
					[1, 1, 0, 0, 0, 0, 0],
					[1, 1, 0, 1, 1, 1, 0],
					[1, 1, 0, 0, 0, 1, 1],
					[1, 1, 0, 0, 0, 1, 1],
					[1, 1, 0, 0, 0, 1, 1],
					[1, 1, 0, 0, 0, 1, 1],
					[0, 1, 1, 1, 1, 1, 0]
				],
				[
					[1, 1, 1, 1, 1, 1, 1],
					[1, 1, 0, 0, 0, 1, 1],
					[0, 0, 0, 0, 1, 1, 0],
					[0, 0, 0, 0, 1, 1, 0],
					[0, 0, 0, 1, 1, 0, 0],
					[0, 0, 0, 1, 1, 0, 0],
					[0, 0, 1, 1, 0, 0, 0],
					[0, 0, 1, 1, 0, 0, 0],
					[0, 0, 1, 1, 0, 0, 0],
					[0, 0, 1, 1, 0, 0, 0]
				],
				[
					[0, 1, 1, 1, 1, 1, 0],
					[1, 1, 0, 0, 0, 1, 1],
					[1, 1, 0, 0, 0, 1, 1],
					[1, 1, 0, 0, 0, 1, 1],
					[0, 1, 1, 1, 1, 1, 0],
					[1, 1, 0, 0, 0, 1, 1],
					[1, 1, 0, 0, 0, 1, 1],
					[1, 1, 0, 0, 0, 1, 1],
					[1, 1, 0, 0, 0, 1, 1],
					[0, 1, 1, 1, 1, 1, 0]
				],
				[
					[0, 1, 1, 1, 1, 1, 0],
					[1, 1, 0, 0, 0, 1, 1],
					[1, 1, 0, 0, 0, 1, 1],
					[1, 1, 0, 0, 0, 1, 1],
					[0, 1, 1, 1, 0, 1, 1],
					[0, 0, 0, 0, 0, 1, 1],
					[0, 0, 0, 0, 0, 1, 1],
					[0, 0, 0, 0, 1, 1, 0],
					[0, 0, 0, 1, 1, 0, 0],
					[0, 1, 1, 0, 0, 0, 0]
				],
				[
					[0, 0, 0, 0],
					[0, 0, 0, 0],
					[0, 1, 1, 0],
					[0, 1, 1, 0],
					[0, 0, 0, 0],
					[0, 0, 0, 0],
					[0, 1, 1, 0],
					[0, 1, 1, 0],
					[0, 0, 0, 0],
					[0, 0, 0, 0]
				]
			];

			function i(z) {
				var D = [];
				d.fillStyle = "#005eac";
				var r = new Date();
				var u = 70,
					t = 30;
				var B = r.getHours();
				var y = Math.floor(B / 10);
				var w = B % 10;
				D.push({
					num: y
				});
				D.push({
					num: w
				});
				D.push({
					num: 10
				});
				var s = r.getMinutes();
				var y = Math.floor(s / 10);
				var w = s % 10;
				D.push({
					num: y
				});
				D.push({
					num: w
				});
				D.push({
					num: 10
				});
				var C = r.getSeconds();
				var y = Math.floor(C / 10);
				var w = C % 10;
				D.push({
					num: y
				});
				D.push({
					num: w
				});
				for (var A = 0; A < D.length; A++) {
					D[A].offsetX = u;
					u = o(u, t, D[A].num, z);
					if (A < D.length - 1) {
						if ((D[A].num != 10) && (D[A + 1].num != 10)) {
							u += h
						}
					}
				}
				if (l.length == 0) {
					l = D
				} else {
					for (var v = 0; v < l.length; v++) {
						if (l[v].num != D[v].num) {
							f(D[v]);
							l[v].num = D[v].num
						}
					}
				}
				q(z);
				p();
				return r
			}

			function f(u) {
				var t = u.num;
				var s = m[t];
				for (var w = 0; w < s.length; w++) {
					for (var r = 0; r < s[w].length; r++) {
						if (s[w][r] == 1) {
							var v = {
								offsetX: u.offsetX + j + j * 2 * r,
								offsetY: 30 + j + j * 2 * w,
								color: a[Math.floor(Math.random() * a.length)],
								g: 1.5 + Math.random(),
								vx: Math.pow(-1, Math.ceil(Math.random() * 10)) * 4 + Math.random(),
								vy: -5
							};
							b.push(v)
						}
					}
				}
			}

			function q(r) {
				for (var s = 0; s < b.length; s++) {
					r.beginPath();
					r.fillStyle = b[s].color;
					r.arc(b[s].offsetX, b[s].offsetY, j, 0, 2 * Math.PI);
					r.fill()
				}
			}

			function p() {
				var s = 0;
				for (var r = 0; r < b.length; r++) {
					var t = b[r];
					t.offsetX += t.vx;
					t.offsetY += t.vy;
					t.vy += t.g;
					if (t.offsetY > (k - j)) {
						t.offsetY = k - j;
						t.vy = -t.vy * n
					}
					if (t.offsetX > j && t.offsetX < (g - j)) {
						b[s] = b[r];
						s++
					}
				}
				for (; s < b.length; s++) {
					b.pop()
				}
			}

			function o(s, z, v, u) {
				var t = m[v];
				for (var w = 0; w < t.length; w++) {
					for (var r = 0; r < t[w].length; r++) {
						if (t[w][r] == 1) {
							u.beginPath();
							u.arc(s + j + j * 2 * r, z + j + j * 2 * w, j, 0, 2 * Math.PI);
							u.fill()
						}
					}
				}
				u.beginPath();
				s += t[0].length * j * 2;
				return s
			}
			var e = document.getElementById("canvas");
			e.width = g;
			e.height = k;
			d = e.getContext("2d");
			var c = new Date();
			setInterval(function() {
				d.clearRect(0, 0, d.canvas.width, d.canvas.height);
				i(d)
			}, 50)
		});
		// ****************************** 炫酷倒计时 end *********************************
	</script>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值