终于没有兼容bug了 。。。
[html]
<!doctype html>
<html>
<head>
<meta chart=”utf-8″>
<title></title>
<stylei9处理器 type=”text/css”>
* {
margin: 0;
padding: 0;
}
canvas {
box-shadow: 0 0 10px 10px #cccccc;
display: block;
margin: 50px auto 0;
}
</style>
<script type=”text/javascript”>
window.onload = function() {
new canvasclock({
canvas: document.getelementbyid(“canvas”),
r: 100,
h: [0, -30],
m: [0, -60],
s: [0, -90]
})
};
function canvasclock(opts) {
var lf = this;
lf.r = opts.r;
lf.h = opts.h;
lf.m = opts.m;
lf.s = opts.s;
lf.pi = math.pi;
lf.canvas = opts.canvas;
lf.context =戴隐形眼镜好不好 lf.canvas.getcontext(“2d”);
window.tinterval长发美女(function() {
lf.canvas.width = 0;
lf.canvas.height = 0;
lf.canvas.width = 400;
lf.canvas.height = 400;
lf.context.strokestyle = “rgba(255,0,0,0.1)”;
lf.context.translate(lf.r * 2, lf.r * 2);
lf.createtime(“m”);
lf.createtime(“h”);
lf.createtime(“s”)
},
1000)
};
canvasclock.prototype = {
createtime: function(str) {
var lf = this;
var context = lf.context;
context.linewidth = 1;
context.beginpath();
context.arc(0, 0, lf.r, 0, 2 * lf.pi, true);
context.stroke();
context.clopath();
var s = (new date()).getconds();
var m = (new date()).getminutes();
var h = (new date()).gethours();
if (str == “s”) {
var t = s * 6;
var x = lf.s[0];
var y = lf.s[1]
} el if (str == “m”) {
var t = (m + s / 60) * 6;
var x =我好想让粗求透我 lf.m[0];
var y = lf.m[1]
} el {
var t = (h + m / 60) * 30;
var x = lf.h[0];
var y = lf.h[1]
}
context.linewidth = 10;
context.linecap = “round”;
context.rotate(t * lf.pi / 180);
context.beginpath();
context.moveto(0, 0);
context.lineto(x, y);
context.stroke();
context.clopath()
}
}
</script>
</head>
<body>
<canvas wi高中政治怎么学才能学好dth=”400″ height=”400″ id=”canvas”></canvas>
</body>
</html>
摘自 事与愿违
本文发布于:2023-04-03 01:37:19,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/deee0509f88b59b2f63e017b64ad20cc.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:html5 canvas绘制钟表.doc
本文 PDF 下载地址:html5 canvas绘制钟表.pdf
留言与评论(共有 0 条评论) |