drawingContext

(別名: drawing_context)

def setup
  drawingContext.shadowOffsetX =  5
  drawingContext.shadowOffsetY = -5
  drawingContext.shadowBlur    = 10
  drawingContext.shadowColor   = 'black'
  background(200)
  ellipse(width / 2, height / 2, 50, 50)
end

p5.jsリファレンス(参考情報)

[p5.js] drawingContext

概要

HTML5の CanvasAPIを直接操作するための描画コンテキストです。

書式

drawingContext

備考

・JavaScriptの構文で「canvas.getContext('2d');」または「canvas.getContext('webgl');」を呼び出すのと同じです。
・drawingContextを通して処理できることの詳細については、下記の URLなどを参照してください。
  CanvasRenderingContext2D

・2D描画コンテキストのおもな要素

プロパティ備考
1canvas
2direction
3fillStyle
4filter
5font
6fontKerning
7fontStretch
8fontVariantCaps
9globalAlpha
10globalCompositeOperation
11imageSmoothingEnabled
12imageSmoothingQuality
13letterSpacing
14lineCap
15lineDashOffset
16lineJoin
17lineWidth
18miterLimit
19shadowBlur
20shadowColor
21shadowOffsetX
22shadowOffsetY
23strokeStyle
24textAlign
25textBaseline
26textRendering
27wordSpacing
メソッド備考
1arc
2arcTo
3beginPath
4bezierCurveTo
5clearRect
6clip
7closePath
8createConicGradient
9createImageData
10createLinearGradient
11createPattern
12createRadialGradient
13drawFocusIfNeeded
14drawImage
15ellipse
16fill
17fillRect
18fillText
19getContextAttributes
20getImageData
21getLineDash
22getTransform
23isContextLost
24isPointInPath
25isPointInStroke
26lineTo
27measureText
28moveTo
29putImageData
30quadraticCurveTo
31rect
32reset
33resetTransform
34restore
35rotate
36roundRect
37save
38scale
39setLineDash
40setTransform
41stroke
42strokeRect
43strokeText
44transform
45translate

関連