今天实在是找不到能够记录的代码笔记了,编写一个彩虹样式好了,图样如下所示:

canvas绘制彩虹样式

代码如下所示:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
*{margin:0; padding:0;}
body{width:100%; height:100%; overflow:hidden;}
#canvas{background:no-repeat center center; background-size:100% 100%;}
</style>
</head>
<body>
<canvas ;
};

function action(){
for(var i=0;i<7;i++){
context.strokeStyle = color[i];
context.lineWidth = lineWidth;
context.beginPath();
context.arc(x,y,radius-(lineWidth*i),Math.PI,a*Math.PI);
context.stroke();
}
}

var t = setInterval(function(){
if(a < 2){
a = a+0.01;
action();
}else if(a >= 2){
clearInterval(t);
}
},time/100);

</script>
</body>
</html>

好了,今天记录canvas代码,明天我会记录canvas的国旗样式!

相关文章:

  • 2021-06-14
  • 2022-12-23
  • 2021-11-28
  • 2022-01-22
  • 2022-12-23
  • 2021-10-16
猜你喜欢
  • 2022-12-23
  • 2021-08-05
  • 2021-11-17
  • 2022-12-23
  • 2021-10-04
  • 2021-05-21
  • 2021-12-02
相关资源
相似解决方案