Advertisement
Guest User

resetme

a guest
May 19th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <!--
  3. To change this license header, choose License Headers in Project Properties.
  4. To change this template file, choose Tools | Templates
  5. and open the template in the editor.
  6. -->
  7. <html>
  8.     <head>
  9.         <title>TODO supply a title</title>
  10.         <meta charset="UTF-8">
  11.         <meta name="viewport" content="width=device-width, initial-scale=1.0">
  12.         <style>
  13.             canvas {
  14.                 position: fixed; left: 10px; top: 10px;
  15.             }
  16.         </style>
  17.         <script>        
  18.             var canvas;
  19.             var ctx;
  20.             function init()
  21.             {
  22.                 canvas=document.getElementById("canvas");
  23.                 ctx=canvas.getContext("2d");
  24.                 animacja();
  25.             }
  26.             y=100;
  27.                 x=100;
  28.             function animacja()
  29.             {
  30.                 requestAnimationFrame(animacja);
  31.                 ctx.clearRect(0,0,innerWidth,900);
  32.                 ctx.beginPath();
  33.                 ctx.arc(x,y,15,0,2*Math.PI);
  34.                 ctx.stroke();
  35.                 ctx.fillStyle = "#cccccc";
  36.                 ctx.fill();
  37.                 x=x+5;
  38.                 if(x==1200)
  39.                 {
  40.                    x=100;
  41.                 }
  42.             }
  43.            
  44.         </script>
  45.     </head>
  46.     <body onload="init()">
  47.         <canvas id="canvas" width="1280" height="720" border="2px"></canvas>
  48.     </body>
  49. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement