canvas立體效果的圓環
分享一段程式碼例項,它利用canvas實現了立體圓環效果。
程式碼例項如下:
[HTML] 純文字檢視 複製程式碼執行程式碼<!doctype html> <html> <head> <meta charset="utf-8"> <meta name="author" content="http://www.softwhy.com/" /> <title>螞蟻部落</title> <style> canvas { border:2px dotted #ccc; } </style> </head> <body> <canvas id="canvas" width="550" height="450"></canvas> <script type="text/javascript"> var canvas = document.getElementById('canvas'); var context = canvas.getContext('2d'); function drawTwoArcs() { context.beginPath(); context.arc(300, 190, 150, 0, Math.PI * 2, false); context.arc(300, 190, 100, 0, Math.PI * 2, true); context.fill(); } function draw() { context.clearRect(0, 0, context.canvas.width, context.canvas.height); context.save(); context.shadowColor = "rgba(0,0,0,0.8)"; context.shadowOffsetX = 12; context.shadowOffsetY = 12; context.shadowBlur = 15; drawTwoArcs(); context.restore(); } context.fillStyle = "rgba(100,140,230,0.5)"; draw(); </script> </body> </html>
相關文章
- canvas 繪製立體圓環Canvas
- canvas圓形時鐘效果Canvas
- canvas繪製多個圓圈效果Canvas
- CSS3簡單圓角立體按鈕效果CSSS3
- canvas環形進度條效果Canvas
- canvas繪製圓盤走動鐘錶效果Canvas
- canvas繪製圓形框效果不填充內部Canvas
- CSS3圓環效果程式碼CSSS3
- Canvas畫圖-一個比想象中更騷氣的圓(漸變圓環)Canvas
- Canvas 繪製 3d 圓柱體Canvas3D
- 立體感的邊框陰影效果
- CSS 文字立體凸起效果CSS
- canvas繪製不重合的圓Canvas
- 炫酷的圓環載入及數字滾動效果(下)
- 炫酷的圓環載入及數字滾動效果(上)
- canvas 繪製圓形Canvas
- canvas矩形拖拽效果Canvas
- canvas小球碰壁效果Canvas
- canvas簽名效果Canvas
- 圓形放大的hover效果
- canvas實現 漂亮的下雨效果Canvas
- canvas具有漸變效果的矩形Canvas
- canvas透明度的矩形效果Canvas
- CSS3 文字立體凸起效果CSSS3
- canvas 繪製圓角矩形Canvas
- canvas蔚藍星空效果Canvas
- canvas繪製流星效果Canvas
- canvas小球擺動效果Canvas
- canvas實現波浪效果Canvas
- 陰影進階,實現更加的立體的陰影效果!
- canvas設定陰影效果Canvas
- canvas簡單畫板效果Canvas
- canvas繪製風車效果Canvas
- canvas動態時鐘效果Canvas
- AUTOCAD——圓環
- 學習 canvas 的 globalCompositeOperation 做出的神奇效果Canvas
- CSS 陰影進階,實現更加的立體的陰影效果!CSS
- 使用canvas繪製圓弧動畫Canvas動畫