def setup
createCanvas(100, 100)
background(0)
@pg = createGraphics(50, 100)
@pg.fill(0)
frameRate(5)
end
def draw
image(@pg, width / 2, 0)
@pg.background(255)
rect(0, 0, width / 2, 5)
@pg.rect(0, 0, width / 2, 5)
translate(0, 5, 0)
@pg.translate(0, 5, 0)
end
def mouseClicked
# if you click you will see that
# 'reset' resets the translate back to the initial state
# of the Graphics object
@pg.reset
end
[p5.js] (p5.Graphics.obj).reset
座標変換の設定など、描画用オブジェクト(グラフィックバッファ)に対して自動的にクリアされない値をリセットします。
なし
obj (メソッドを呼び出した p5graphicsオブジェクト自身)