html5中canvas線段繪製太陽花
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>canvas線段繪製太陽花</title>
</head>
<body>
<canvas id="myCanvas" width="800" height="800"></canvas>
<script type="text/javascript">
var canvas=document.getElementById("myCanvas");
var context=canvas.getContext("2d");
context.fillStyle="black";
context.fillRect(0,0,400,300);
var n=0;
var dx=150;
var dy=150;
var s=100;
context.beginPath();
context.strokeStyle="burlywood";
context.fillStyle="darkorange";
var x=Math.sin(0);
var y=Math.cos(0);
var dig=Math.PI/15*11;
for(var i=0;i<30;i++){
var x=Math.sin(i*dig);
var y=Math.cos(i*dig);
context.lineTo(dx+x*s,dy+y*s);
}
context.closePath();
context.fill();
context.stroke();
</script>
</body>
</html>
<html>
<head>
<meta charset="UTF-8">
<title>canvas線段繪製太陽花</title>
</head>
<body>
<canvas id="myCanvas" width="800" height="800"></canvas>
<script type="text/javascript">
var canvas=document.getElementById("myCanvas");
var context=canvas.getContext("2d");
context.fillStyle="black";
context.fillRect(0,0,400,300);
var n=0;
var dx=150;
var dy=150;
var s=100;
context.beginPath();
context.strokeStyle="burlywood";
context.fillStyle="darkorange";
var x=Math.sin(0);
var y=Math.cos(0);
var dig=Math.PI/15*11;
for(var i=0;i<30;i++){
var x=Math.sin(i*dig);
var y=Math.cos(i*dig);
context.lineTo(dx+x*s,dy+y*s);
}
context.closePath();
context.fill();
context.stroke();
</script>
</body>
</html>
相關文章
- html5中canvas繪製線段HTMLCanvas
- html5中canvas繪製貝塞爾曲線HTMLCanvas
- html5中canvas貝塞爾曲線繪製菊花HTMLCanvas
- html5中canvas繪製矩形HTMLCanvas
- canvas核心技術-如何繪製線段Canvas
- html5中canvas繪製圓形HTMLCanvas
- canvas 繪製線條Canvas
- canvas繪製直線Canvas
- html5中的canvas繪製橢圓的方法HTMLCanvas
- canvas 繪製雙線技巧Canvas
- html5 canvas學習--繪製文字HTMLCanvas
- HTML5使用canvas繪製圖形HTMLCanvas
- canvas繪製sin正弦曲線Canvas
- 使用 HTML5 Canvas 繪製的水滴效果HTMLCanvas
- canvas繪製網格射線效果Canvas
- HTML5 Canvas ( 矩形的繪製 ) rect, strokeRect, fillRectHTMLCanvas
- HTML5 Canvas使用路徑——繪製圓形HTMLCanvas
- canvas繪製經典星空連線效果Canvas
- HTML5 Canvas(實戰:繪製餅圖2 Tooltip)HTMLCanvas
- HTML5利用canvas繪製矩形程式碼例項HTMLCanvas
- canvas 繪製矩形Canvas
- canvas 繪製扇形Canvas
- canvas 繪製文字Canvas
- canvas繪製拋物線程式碼例項Canvas線程
- 繪製SVG內容到Canvas的HTML5應用SVGCanvasHTML
- 在Canvas中繪製Geojson資料CanvasJSON
- canvas 繪製圓形Canvas
- canvas繪製流星效果Canvas
- canvas繪製帶有漸變效果的直線Canvas
- 如何使用echart中獲取canvas繪製到自己的canvas上去Canvas
- Canvas 繪製雷達圖Canvas
- canvas繪製動畫的技巧Canvas動畫
- canvas 繪製立體圓環Canvas
- canvas 繪製文字詳解Canvas
- canvas 繪製圓角矩形Canvas
- canvas 繪製矩形缺角Canvas
- canvas繪製風車效果Canvas
- canvas繪製笑臉表情Canvas