Advertisement
Guest User

Untitled

a guest
Dec 4th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <canvas id="gameCanvas" width="800" height="600"></canvas>
  4.  
  5. <script>
  6. var canvas;
  7. var canvasContext;
  8.  
  9. var imageNew = document.createElement("img");
  10.  
  11. window.onload = function() {
  12. canvas = document.getElementById('gameCanvas');
  13. canvasContext = canvas.getContext('2d');
  14.  
  15. imageNew.src = 'hello.png';
  16. imageNew.onload = function() {
  17. drawKENNETH();
  18. }
  19. }
  20.  
  21. function drawKENNETH() {
  22. canvasContext.fillStyle = 'black';
  23. canvasContext.fillRect(0,0,canvas.width,canvas.height);
  24. canvasContext.drawImage(imageNew,10,10);
  25. }
  26. </script>
  27. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement