canvas徑向漸變程式碼例項
分享一段程式碼例項,它演示了徑向漸變效果。
程式碼如下:
[HTML] 純文字檢視 複製程式碼<!doctype html> <html> <head> <meta charset="utf-8"> <meta name="author" content="http://www.softwhy.com/" /> <title>螞蟻部落</title> </head> <body> <canvas id="drawing"></canvas> <script> var drawing = document.getElementById("drawing"); if (drawing.getContext) { var context = drawing.getContext("2d"); //建立漸變例項 var gradient = context.createRadialGradient(55, 55, 10, 55, 55, 30); gradient.addColorStop(0, "white"); gradient.addColorStop(1, "black"); //繪製漸變矩形 context.fillStyle = gradient; context.fillRect(30, 30, 50, 50); } </script> </body> </html>
相關文章
- canvas簡單徑向漸變程式碼例項Canvas
- css徑向漸變程式碼例項CSS
- canvas線性漸變程式碼例項Canvas
- css3實現的徑向漸變和線性漸變程式碼例項CSSS3
- canvas createRadialGradient() 徑向漸變Canvas
- canvas實現文字線性漸變效果程式碼例項Canvas
- 使用canvas來完成線性漸變和徑向漸變的功能Canvas
- html5中canvas徑向漸變(發散)HTMLCanvas
- CSS3背景漸變效果程式碼例項CSSS3
- CSS3線性漸變和徑向漸變CSSS3
- jquery漸隱漸現程式碼例項jQuery
- canvas實現的變幻線程式碼例項Canvas線程
- canvas刮刮樂程式碼例項Canvas
- javascript元素透明度漸變效果程式碼例項JavaScript
- SVG <radialGradient> 徑向漸變SVG
- javascript文字彩虹式顏色漸變效果程式碼例項JavaScript
- css3線性漸變簡單程式碼例項CSSS3
- canvas畫圖程式碼例項Canvas
- canvas小遊戲程式碼例項Canvas遊戲
- canvas火焰效果程式碼例項Canvas
- canvas繪製扇形程式碼例項Canvas
- canvas繪製星星程式碼例項Canvas
- canvas字母雨效果程式碼例項Canvas
- canvas載入效果程式碼例項Canvas
- canvas 繪製雞蛋程式碼例項Canvas
- canvas縮放div程式碼例項Canvas
- canvas擺動效果程式碼例項Canvas
- CSS radial-gradient()徑向漸變CSS
- css3實現的漸變線交錯程式碼例項CSSS3
- canvas水位進度效果程式碼例項Canvas
- canvas原型鐘錶效果程式碼例項Canvas原型
- canvas氣泡上浮效果程式碼例項Canvas
- canvas寫字板功能程式碼例項Canvas
- canvas繪製網格程式碼例項Canvas
- canvas貪吃蛇遊戲程式碼例項Canvas遊戲
- canvas實現的刮刮樂程式碼例項Canvas
- canvas田字格效果程式碼例項Canvas
- canvas繪製笑臉程式碼例項Canvas