Advertisement
Guest User

Untitled

a guest
Jun 25th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1.  
  2. <!--Version 0.1-->
  3. <!DOCTYPE html>
  4. <html>
  5. <head>
  6. <meta charset="utf-8"/>
  7. <title>Boomerang alpha</title></head>
  8. <body onload="programStart();">
  9. <canvas id="mainScreen" width="800" height="600"></canvas>
  10. <script type='text/javascript'>
  11. var canvas=document.getElementById('mainScreen');
  12. var ctx=canvas.getContext('2d');
  13. var cursor = {
  14. x: 10,
  15. y: 10,
  16. color1: 'blue',
  17. color2: 'black',
  18. }
  19.  
  20.  
  21. function programStart()
  22. {
  23. drawBackgr();
  24. drawCursor();
  25. }
  26.  
  27. function drawBackgr()
  28. {
  29. ctx.fillStyle = 'black';
  30. ctx.fillRect(0,0,800,600);
  31. ctx.fillStyle = 'gray';
  32. ctx.fillRect(0,50,800,10);
  33. }
  34.  
  35. input = 0;
  36.  
  37. function drawCursor()
  38. {
  39. ctx.fillStyle = cursor.color1;
  40.  
  41. if (input%2) {
  42. ctx.fillStyle = 'black';
  43. }
  44. ctx.fillRect(cursor.x,cursor.y,20,30);
  45. cursor.color1 = 'blue';
  46. input++;
  47.  
  48. }
  49.  
  50. setInterval(drawCursor, 500);
  51.  
  52. function clearCursor(){
  53. ctx.fillStyle = 'black';
  54. ctx.fillRect(cursor.x,cursor.y,30);
  55. }
  56.  
  57.  
  58.  
  59.  
  60. </script>
  61. </body>
  62. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement