def setup
@img = loadImage("fruit.png")
@img.loadPixels
halfImage = 4 * @img.width * @img.height / 2
for i in (0...halfImage) do
@img.pixels[i + halfImage] = @img.pixels[i]
end
@img.updatePixels
end
def draw
image(@img, 0, 0, width, height)
end
[p5.js] (p5.Image.obj).loadPixels
イメージ上のピクセルデータを pixels配列にロードします。
なし
なし