Well, you'll want to use a function that loads images at a specific point, so you can also try to understand onLoad. This is not so hard to understand.
"onload" is a javascript event that occurs immediately after loading. In other words: onLoad is similar to the javascript-native function, which runs when something loads. It can be a window (for example: window.onload) or a document. What you want is the onLoad event of the document, since it fires when the document loads.
Provide you a simple example ...
<body onload="preloadMyImages();">
This tells the browser "when you have loaded the document, run the preloadMyImages function".
All you have to do is use this function to upload images to the client’s browser cache.
function preloadMyImages() { var imageList = [ "image.gif", "example/image.jpg", "whatever/image.png" ]; for(var i = 0; i < imageList.length; i++ ) { var imageObject = new Image(); imageObject.src = imageList[i]; } }
This almost completes the job and provides you with a complete working example. Enjoy it!
EDIT
Since, according to your comment, you are looking for additional help, I would like to point you to fooobar.com/questions/442859 / ... , which (as one of many examples) shows how you can (and probably should - in depending on what you plan to do on your canvas) also use img.onload.
However, as I said in my comment: everything will depend on where you want to take it. The more you immerse yourself in Javascript encoding, the more you will understand what is going on. There are some good (partially free) books explaining how to code Javascript, use HTML5 canvas, create preloaders, animations, talk about clouds, etc.
A quick check in the big G search engines includes many examples and tutorials to help you. One of many examples is "" "How to Draw Images on Your HTML5 Canvas" "", which shows how you preload the animation and loop the animation in a short and clear tutorial.
But please do not expect a code from us for you - this will not happen. This is one of the rare cases where “learning by doing” actually makes you smarter. And if you encounter another problem on the way to your ultimate goal, you can always post a new question related to this new problem.