I’m currently following the tutorials from The Coding Train on p5.js and I’ve run into a problem with the createA() DOM element. They are a bit older and I’m not sure if this is a bug or something I’m doing wrong…
In videos 8.13 and 8.14 Dan use ‘#’ instead of a url, like this:
var a = createA('#', 'apples');
a.mousePressed(addPhoto);
function addPhoto() {
var img = createImg('apples2.jpg', 'apples');
img.size(100, 100);
}
In the video nothing happens with a mouseclick except the function addPhoto, which loads an image of an apple. When I click, the current page (the p5.js editor) is loaded in the preview window. I can even run the code again in this version and the same happens again.
Sometimes it happens the first time I click and sometimes only the second time. Earlier I occasionally also saw the p5.js 404 error page, but for some reason I can’t reproduce this anymore.
This is the sketch in the editor.
I hope someone can help me figure out what I’m doing wrong or point out another way to do it. It’s not really the most important part of the tutorials, but it’s really frustrating when I’m trying different things and every time I can hardly see what occurred before this happens again.
Thanks,
Vera