課程
/前端開發
/JavaScript
/JS實現人機大戰之五子棋(UI篇)
這個怎么設置API的,在w3c上也看不明白為什么,求大神詳解
2017-04-12
源自:JS實現人機大戰之五子棋(UI篇) 2-4
正在回答
這個我知道,但漸變過程怎么演示,還有漸變部分怎么截取
<!DOCTYPE?html> <html> <head> <meta?charset="utf-8"> <title>來自菜鳥教程的代碼</title> </head> <body> <canvas?id="myCanvas"?width="300"?height="150"?style="border:1px?solid?#d3d3d3;"> 您的瀏覽器不支持?HTML5?canvas?標簽。 </canvas> <div> x0?:???漸變的開始圓的?x?坐標????</br> y0?:???漸變的開始圓的?y?坐標????</br> r0?:???開始圓的半徑????</br> x1?:???漸變的結束圓的?x?坐標????</br> y1?:???漸變的結束圓的?y?坐標????</br> r1?:???結束圓的半徑???? </div> <script> var?c=document.getElementById("myCanvas"); var?ctx=c.getContext("2d"); var?grd=ctx.createRadialGradient(75,50,5,90,60,100); grd.addColorStop(0,"red"); grd.addColorStop(1,"white"); ctx.fillStyle=grd; ctx.fillRect(10,10,150,100); </script> </body> </html>
舉報
利用js及canvas繪圖知識,實現程序界面編寫和交互邏輯處理
1 回答index.js:33 Uncaught TypeError: Failed to execute 'createRadialGradient' on 'CanvasRenderingContext2D': The provided double value is non-finite.
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2017-04-14
這個我知道,但漸變過程怎么演示,還有漸變部分怎么截取
2017-04-13