November 2011
Intermediate to advanced
348 pages
7h 2m
English
This recipe essentially combines the concepts from the previous two recipes to demonstrate how we can drag-and-drop an image.
Follow these steps to drag-and-drop an image:
Events class:<script src="events.js"> </script>
writeMessage() function which writes out a message:<script>
function writeMessage(context, message){
context.font = "18pt Calibri";
context.fillStyle = "black";
context.fillText(message, 10, 25);
}drawImage() function which begins by instantiating a new Events object and setting the initial position of the rectangular region that overlays the image: function drawImage(challengerImg){ var events = new Events("myCanvas"); var canvas = events.getCanvas(); var ...Read now
Unlock full access