Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <!--
- To change this license header, choose License Headers in Project Properties.
- To change this template file, choose Tools | Templates
- and open the template in the editor.
- -->
- <html>
- <head>
- <title>TODO supply a title</title>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <style>
- canvas {
- position: fixed; left: 10px; top: 10px;
- }
- </style>
- <script>
- var canvas;
- var ctx;
- function init()
- {
- canvas=document.getElementById("canvas");
- ctx=canvas.getContext("2d");
- animacja();
- }
- y=100;
- x=100;
- function animacja()
- {
- requestAnimationFrame(animacja);
- ctx.clearRect(0,0,innerWidth,900);
- ctx.beginPath();
- ctx.arc(x,y,15,0,2*Math.PI);
- ctx.stroke();
- ctx.fillStyle = "#cccccc";
- ctx.fill();
- x=x+5;
- if(x==1200)
- {
- x=100;
- }
- }
- </script>
- </head>
- <body onload="init()">
- <canvas id="canvas" width="1280" height="720" border="2px"></canvas>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement