zookeeper python接口实例详解
228
2023-06-13
Canvas实现放射线动画效果
效果如下:
代XIgGbW码如下:
body {background: #000;overflow: hidden;margin: 0;padding: 0;}
#canv {width: 45%;margin: 5% 30%;animation: wheehttp://l-rotate 30s linear infinite;}
@keyframes wheel-rotate {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
var c;
var $;
var w = 600;
var h = 600;
constant = 15;
var rad = 300;
var timeout = 0;
c = document.getElementById("canv");
$ = c.getContext("2d");
drawLines();
function drawLines() {
$.fillRect(0,0,w,h);
$.translate(w/2,h/2);
for (var i = 0; i < 25; i++) {
for (var n = -45; n <= 45; n+=constant) {
setTimeout("draw("+n+");",100 * timeout);
timeout++;
}
}
}
function draw(n){
$.beginPath();
$.moveTo(0,rad);
var radians = Math.PI/180*n;
var x = (rad * Math.sin(radians)) / Math.sin(Math.PI/2 - radians);
$.lineTo(x,0);
if (Math.abs(n) == 45) {
$.strokeStyle=rndColor();
$.lineWidth=2;
} else if (n == 0) {
$.strokeStyle="rgb(200,200,200)";
$.lineWidth=.5;
} else {
$.strokeStyle="rgb(110,110,110)";
$.lineWidth=.5;
}
$.stroke();
$.rotate((Math.PI/180)*15);
}
function rndColor() {
var r = 255*Math.random()|0,
g = 255*Math.random()|0,
b = 255*Math.random()|0;
return 'rgb(' + r + ',' + g + ',' + b + ')';
}
function myrefresh(){
//window.location.relhttp://oad();
//drawLines()
}
//setTimeout('myrefresh()',100*175);
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~