createGraphics

def setup
  createCanvas(100, 100)
  @pg = createGraphics(100, 100)
end

def draw
  background(200)
  @pg.background(100)
  @pg.noStroke
  @pg.ellipse(@pg.width / 2, @pg.height / 2, 50, 50)
  image(@pg, 50, 50)
  image(@pg, 0, 0, 50, 50)
end

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

[p5.js] createGraphics

概要

描画用オブジェクト(グラフィックバッファ)を生成します。

書式

createGraphics(w, h [, renderer])

引数

引数名内容備考オプションデフォルト値
w描画用オブジェクトの幅ピクセル
h描画用オブジェクトの高さピクセル
rendererモードP2D : 2次元
WEBGL : 3次元
P2D

戻値

p5.Graphicsオブジェクト

備考

関連

p5.Graphicsオブジェクト