Skip to content Skip to sidebar Skip to footer

Adding Image To Javascript Canvas Using Relative File Path

I feel like there is a very simple way to do this, yet I can't find it. I have an image whose relative path to my clientscript.js file is ./images/orig classic pokemon frame.png.

Solution 1:

context isn't a global variable. As such, using it in the 'onload' function is out of it's scope.

There was nothing wrong with your src if it would work in an <img> element.

Post a Comment for "Adding Image To Javascript Canvas Using Relative File Path"