Hello all am working on some very simple js for canvas.
in the functions.php i have appropriately enqueued the script. it worked fine for rectangle fills, etc…
but when i go and try to load an image if fails. has anyone else run into this?
var myImage = new Image();
myImage.src = "waterfall/imgs/marbleAA.png";
function draw(){
var ctx = document.getElementById('canvas1').getContext('2d');
//alert(ctx.canvas.id+ "|" +ctx.canvas.width+ "|" +ctx.canvas.height);
var pattern =ctx.createPattern(myImage, "repeat");
ctx.fillStyle = pattern;
ctx.fillRect(0,0,200,200);
ctx.fill();
}
that is in my js folder, in the same theme folder i have an imgs folder w/the images
i tried imgs/image.png, /imgs/image.png, …/imgs.image.png
I tried the localhost/theme/etc…
don’t understand why it won’t link in the js. Images are coming through fine as css backgrounds too.
thx
D