Hello, I’m trying to work with p5.dom to play with html divs and cliquable links.
Everything seems to work fine when i’m trying this code in my processing program and even if I copy it to a tumblr.
Here is my code so far :
<!DOCTYPE` html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.2/p5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.2/addons/p5.dom.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.2/addons/p5.sound.min.js"></script>
<meta charset="utf-8" />
<style>
html, body {
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<script>
function setup() {
canvas = createCanvas(600, 400);
let txt = createDiv('This is an HTML string!');
txt.position(50, 50);
}
function draw() {
background(220, 180, 200);
ellipse(width/2, height/2, 100, 100);
ellipse(width/4, height/2, 50, 50);
}
</script>
</body>
</html>
I am now trying to import it to my wordpress by using the html editor on my project page.
The code is working fine until I add :
let txt = createDiv('This is an HTML string!');
txt.position(50, 50);
in my firefox console, the error seems to be the following:
ReferenceError: createDiv is not defined
Do you know any way to get over it?
Thanks a lot for your future help.