Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!--Version 0.1-->
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8"/>
- <title>Boomerang alpha</title></head>
- <body onload="programStart();">
- <canvas id="mainScreen" width="800" height="600"></canvas>
- <script type='text/javascript'>
- var canvas=document.getElementById('mainScreen');
- var ctx=canvas.getContext('2d');
- var cursor = {
- x: 10,
- y: 10,
- color1: 'blue',
- color2: 'black',
- }
- function programStart()
- {
- drawBackgr();
- drawCursor();
- }
- function drawBackgr()
- {
- ctx.fillStyle = 'black';
- ctx.fillRect(0,0,800,600);
- ctx.fillStyle = 'gray';
- ctx.fillRect(0,50,800,10);
- }
- input = 0;
- function drawCursor()
- {
- ctx.fillStyle = cursor.color1;
- if (input%2) {
- ctx.fillStyle = 'black';
- }
- ctx.fillRect(cursor.x,cursor.y,20,30);
- cursor.color1 = 'blue';
- input++;
- }
- setInterval(drawCursor, 500);
- function clearCursor(){
- ctx.fillStyle = 'black';
- ctx.fillRect(cursor.x,cursor.y,30);
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement