0
A
回答
0
當然你可以繪製多邊形的方法,你至少有:
- 到quadraticCurveTo
- bezierCurveTo
,看一下此示例代碼:
http://www.html5canvastutorials.com/labs/html5-canvas-playing-card-suits/
1
對於多邊形你可以使用以下(其中CTX是你的畫布的getContext( '2D')):
ctx.fillStyle=*hex code of the color you want it to be";
ctx.beginPath();
ctx.moveTo(x1,y1);
ctx.lineTo(x2,y2);
ctx.lineTo(x3,y3);
*add more points if needed using a lineTo(x,y) for each of your points*
ctx.closePath();
ctx.fill();
如果你想有一個行程多邊形使用ctx.strokeStyle和ctx.stroke()而不是ctx.fillStyle和ctx.fill ()
相關問題
- 1. 如何定位位置上的自定義畫布形狀
- 2. 在畫布中繪製自定義形狀html5
- 3. 在Android上的畫布上繪製自定義形狀
- 4. android使自定義的佈局形狀
- 5. 自定義形狀並填寫HTML5畫布
- 6. android創建自定義形狀佈局
- 7. 用自定義形狀自定義ImageView
- 8. 自定義形狀的iframe
- 9. 自定義形狀:Android的
- 10. 撤消畫布上的選定形狀
- 11. KineticJS:如何將自定義畫布形狀包含在toDataURL函數中
- 12. CSS自定義形狀
- 13. 自定義按鈕形狀
- 14. UIView與自定義形狀
- 15. html5 canvas自定義形狀
- 16. 自定義ActionBar形狀android
- 17. 自定義形狀NSButton
- 18. 作物自定義形狀
- 19. InkAnalyzer UWP - 自定義形狀
- 20. UIViewController.view.superview自定義形狀
- 21. ScatterViewItem自定義形狀
- 22. 自定義形狀ListView
- 23. WPF自定義形狀
- 24. Three.js - 自定義形狀?
- 25. SVG自定義圓形狀
- 26. 使用畫布確定形狀創建
- 27. Limejs中的自定義形狀
- 28. Cocos3d中的自定義形狀
- 29. GIMP中的自定義形狀?
- 30. WPF中的自定義形狀邊框
你曾經在畫布上重新創建過這個形狀嗎? –
不,我用圖像而不是繪製路徑 – sumitmann