Help with Uni question
I have been given this exercise to complete for my Uni class, but am having great difficulty making it work.
Find an image on the internet that you like and copy its URL.
o Make sure it will fit in the dimensions of the canvas!
• Put this code after you declare the context but before you do any drawing:
var myImage = new Image();
myImage.src = “###”
// paste your URL instead of ###!
• The first line declares a new image variable.
• The second line fills the image variable with the contents of the image at the specified URL
(this is called the source, and can either be an image on your computer or on the internet).
• The image won’t display yet because even though it is in memory, it is not being drawn.
• Try to figure out how to get the image displaying on the screen using the canvas
• Once you have done this, create several different images on your hard drive and display
them all at various locations on the canvas.
i have tried adding a source file under the context variable, and before the actual drawing part, but nothing happens. I tried using myImage.drawImage for the drawing part but still ntohign happens. Can someone please help me.