旋转的辐射Logo
var canvas = document.getelementbyid("mycanvas");
var context = canvas.getcontext("2d");
var startp = [0 , 0.67 , 1.34 ];
var endp = [0.3 , 0.97 , 1.64];
var n = 0.01;
var animate;
window.onload = initpage;
function initpage() {
var speed = document.getelementsbytagname("select")[0].value;
window.clearinterval(animate);
animate = setinterval("show()",speed);
}
function show() {
context.clearrect(0,0,500,500);
for(var i = 0 ; i<3 ; i++) {
startp[i] += n;
endp[i] += n;
if(startp[i] == 2) {
startp[i] = 0;
}
if(endp[i] == 2) {
endp[i] = 0;
}
}
context.beginpath();
context.rect(0,0,500,500);
context.linewidth = 1;
context.fillstyle = "#f2ca07";
context.fill();
context.stroke();
context.beginpath();
context.arc(250, 250, 10, 0, 2 * math.pi, false);
context.linewidth = 1;
context.fillstyle = "#333";
context.fill();
context.stroke();
context.beginpath();
context.arc(250, 250, 100, startp[0] * math.pi, endp[0] * math.pi, false);
context.linewidth = 160;
context.strokestyle = "#333";
context.stroke();
context.beginpath();
context.arc(250, 250, 100, startp[1] * math.pi, endp[1] * math.pi, false);
context.linewidth = 160;
context.strokestyle = "#333";
context.stroke();
context.beginpath();
context.arc(250, 250, 100, startp[2] * math.pi, endp[2] * math.pi, false);
context.linewidth = 160;
context.strokestyle = "#333";
context.stroke();
}
demo
摘自 简生的代码备忘录
下一篇: console的方法解析
推荐阅读
-
Java 设置PDF中的文本旋转、倾斜
-
ps文字的变形应用实例详解:制作爱护大自然logo
-
背景图片logo用IE能复制出来,就是找不到背景logo的url地址_html/css_WEB-ITnose
-
CSS3 制作旋转的大风车(充满童年回忆)
-
微信小程序内拖动图片实现移动、放大、旋转的方法
-
PHP图片的等比缩放和增加Logo水印详细代码和注释
-
Winform中使用FastReport的PictureObject时通过代码设置图片源并使Image图片旋转90度
-
PS制作魔幻霸气的金属龙形LOGO
-
css3写的android logo_html/css_WEB-ITnose
-
logo悬空是怎么做到的?卢伟冰:Redmi全息悬浮工艺系全球首发