def setup
drawingContext.shadowOffsetX = 5
drawingContext.shadowOffsetY = -5
drawingContext.shadowBlur = 10
drawingContext.shadowColor = 'black'
background(200)
ellipse(width / 2, height / 2, 50, 50)
end
HTML5の CanvasAPIを直接操作するための描画コンテキストです。
・JavaScriptの構文で「canvas.getContext('2d');」または「canvas.getContext('webgl');」を呼び出すのと同じです。
・drawingContextを通して処理できることの詳細については、下記の URLなどを参照してください。
CanvasRenderingContext2D
・2D描画コンテキストのおもな要素
| プロパティ | 備考 | |
|---|---|---|
| 1 | canvas | |
| 2 | direction | |
| 3 | fillStyle | |
| 4 | filter | |
| 5 | font | |
| 6 | fontKerning | |
| 7 | fontStretch | |
| 8 | fontVariantCaps | |
| 9 | globalAlpha | |
| 10 | globalCompositeOperation | |
| 11 | imageSmoothingEnabled | |
| 12 | imageSmoothingQuality | |
| 13 | letterSpacing | |
| 14 | lineCap | |
| 15 | lineDashOffset | |
| 16 | lineJoin | |
| 17 | lineWidth | |
| 18 | miterLimit | |
| 19 | shadowBlur | |
| 20 | shadowColor | |
| 21 | shadowOffsetX | |
| 22 | shadowOffsetY | |
| 23 | strokeStyle | |
| 24 | textAlign | |
| 25 | textBaseline | |
| 26 | textRendering | |
| 27 | wordSpacing | |
| メソッド | 備考 | |
| 1 | arc | |
| 2 | arcTo | |
| 3 | beginPath | |
| 4 | bezierCurveTo | |
| 5 | clearRect | |
| 6 | clip | |
| 7 | closePath | |
| 8 | createConicGradient | |
| 9 | createImageData | |
| 10 | createLinearGradient | |
| 11 | createPattern | |
| 12 | createRadialGradient | |
| 13 | drawFocusIfNeeded | |
| 14 | drawImage | |
| 15 | ellipse | |
| 16 | fill | |
| 17 | fillRect | |
| 18 | fillText | |
| 19 | getContextAttributes | |
| 20 | getImageData | |
| 21 | getLineDash | |
| 22 | getTransform | |
| 23 | isContextLost | |
| 24 | isPointInPath | |
| 25 | isPointInStroke | |
| 26 | lineTo | |
| 27 | measureText | |
| 28 | moveTo | |
| 29 | putImageData | |
| 30 | quadraticCurveTo | |
| 31 | rect | |
| 32 | reset | |
| 33 | resetTransform | |
| 34 | restore | |
| 35 | rotate | |
| 36 | roundRect | |
| 37 | save | |
| 38 | scale | |
| 39 | setLineDash | |
| 40 | setTransform | |
| 41 | stroke | |
| 42 | strokeRect | |
| 43 | strokeText | |
| 44 | transform | |
| 45 | translate |