Hi,
I’d like to play around with an existing sketch which uses:
function preload() {
img = loadImage(url + str(windowWidth) + random(keywords));
}
Excepted that I don’t want to use an external image, I would like to work on the generated drawings from my sketch.
Here is a very simple code to illustrate what I got:
let pg;
let size = 300;function setup() {
createCanvas(size, size);
pg = createGraphics(size,size)
pg.background(random(255));
art();
noLoop();}
function draw() {
image(pg,0,0, width, height);}
function art(){
for (let i = 0; i < 100; i++) {
pg.fill(random(250),random(250),random(250));
pg.strokeWeight(1.15);
pg.circle(random(size),random(size),random(100));}
}
I would have assumed that adding everything into my pg object would be the equivalent of loadImage but apparently it’s not.
Thanks for your help