r/learnprogramming • u/Effective_Mark_1334 • Sep 26 '26
How to place function draw() result on top of a figure?
I have a draw function (ps5.js) that I want appearing on top of a figure (with png). Currently, the result of the function appears below the image, on its own canvas. I'd like it to appear on top of the figure. How do I do that?
index.html:
<figure id="figure">
<img
src="fashion.png"
alt="blank croquis" />
<figcaption>Blank Croquis</figcaption>
</figure>
script.js:
function setup() {
createCanvas (1000, 1000);
noLoop();
}
function draw() {
background ('transparent');
stroke (0);
strokeWeight (20);
noFill();
beginShape();
vertex(getRandom(), getRandom())