createGraphics

(別名: create_graphics)

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

概要

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

書式

gr = createGraphics(w, h [, renderer])

引数

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

戻値

gr : p5graphicsオブジェクト

備考

・以下のメソッドはおもにメインキャンバス向けに用意されているものですが、
 p5graphicsオブジェクトについてもインスタンスメソッドとして使うことができます。
 (使用例は上記のサンプルプログラムなどを参照してください)

Structure (2メソッド)
push pop
Canvas (1メソッド)
drawingContext
Color (10メソッド)
background clear fill noFill
stroke noStroke erase noErase
colorMode color
Image (14メソッド)
pixels loadPixels updatePixels get set
filter copy blend
image imageMode
tint noTint mask save
Shape (35メソッド)
point line rect square quad
ellipse circle arc triangle
strokeWeight strokeCap strokeJoin
rectMode ellipseMode smooth noSmooth
curve bezier
shape beginShape endShape
vertex curveVertex bezierVertex quadraticVertex
contour beginContour endContour
plane box sphere cylinder cone
ellipsoid torus
3DEffect (1メソッド)
shader
Typography (5メソッド)
text textFont textSize textStyle textAlign
Transform (8メソッド)
translate rotate scale shearX shearY
rotateX rotateY rotateZ
Math (1メソッド)
angleMode

関連

p5graphicsオブジェクト
image