Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Document</title>
- <script type="text/javascript">
- document.addEventListener("DOMContentLoaded", () => {
- let canvas = document.getElementById('canvasId');
- let context = canvas.getContext("2d");
- let x = 400, y = 50;
- context.fillStyle = 'red';
- context.beginPath();
- context.arc(x, y, 20, 0, 2*Math.PI);
- context.closePath();
- context.fill();
- for (var i = 0; i < 5; i++) {
- x += 50;
- y += 50;
- context.fillStyle = 'white';
- context.beginPath();
- context.arc(x, y, 20, 0, 2*Math.PI);
- context.closePath();
- context.fill();
- }
- for (var i = 0; i < 5; i++) {
- x -= 50;
- y += 50;
- context.fillStyle = 'white';
- context.beginPath();
- context.arc(x, y, 20, 0, 2*Math.PI);
- context.closePath();
- context.fill();
- }
- for (var i = 0; i < 5; i++) {
- x -= 50;
- y -= 50;
- context.fillStyle = 'white';
- context.beginPath();
- context.arc(x, y, 20, 0, 2*Math.PI);
- context.closePath();
- context.fill();
- }
- for (var i = 0; i < 4; i++) {
- x += 50;
- y -= 50;
- context.fillStyle = 'white';
- context.beginPath();
- context.arc(x, y, 20, 0, 2*Math.PI);
- context.closePath();
- context.fill();
- }
- });
- </script>
- <style>
- canvas{
- background-color: black;
- }
- </style>
- </head>
- <body>
- <canvas width="800" height="800" id="canvasId"></canvas>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement