Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <document html>
- <head>
- </head>
- <body>
- <canvas id="domek" style="border: 1px solid;" width="1200"
- height="800">
- </canvas>
- <script>
- function rysujDomek() {
- // Pobierz element canvas i jego kontekst
- var canvas = document.getElementById('domek');
- var context = canvas.getContext('2d');
- // Rysuj „ścieżkę” zgodnie z podanymi współrzędnymi
- context.strokeStyle = '#000000';
- context.strokeRect(346, 248, 200, 205);
- context.strokeStyle = '#000000';
- context.fillStyle = '#339900';
- context.beginPath();
- context.moveTo(347, 247);
- context.lineTo(449, 175);
- context.stroke();
- context.closePath();
- context.strokeStyle = '#000000';
- context.beginPath();
- context.moveTo(449, 175);
- context.lineTo(546, 247);
- context.stroke();
- context.closePath();
- context.strokeStyle = '#000000';
- context.strokeRect(367, 275, 51, 47);
- context.strokeStyle = '#000000';
- //okno
- context.strokeRect(472, 277, 1, 0);
- context.strokeStyle = '#000000';
- //okno
- context.strokeRect(472, 277, 46, 44);
- context.strokeStyle = '#000000';
- //okno dolne
- context.strokeRect(472, 376, 46, 48);
- context.strokeStyle = '#000000';
- //drzwi
- context.strokeRect(369, 383, 42, 67);
- context.strokeStyle = '#000000';
- context.beginPath();
- context.moveTo(369, 423);
- context.lineTo(384, 422);
- context.stroke();
- context.closePath();
- context.strokeStyle = '#000000';
- context.beginPath();
- context.moveTo(367, 299);
- context.lineTo(417, 299);
- context.stroke();
- context.closePath();
- context.strokeStyle = '#200000';
- context.beginPath();
- context.moveTo(391, 275);
- context.lineTo(392, 319);
- context.stroke();
- context.closePath();
- context.strokeStyle = '#200000';
- context.beginPath();
- context.moveTo(493, 276);
- context.lineTo(493, 319);
- context.stroke();
- context.closePath();
- context.strokeStyle = '#200000';
- context.beginPath();
- context.moveTo(472, 299);
- context.lineTo(516, 299);
- context.stroke();
- context.closePath();
- context.strokeStyle = '#000000';
- context.beginPath();
- context.moveTo(497, 376);
- context.lineTo(497, 423);
- context.stroke();
- context.closePath();
- context.strokeStyle = '#000000';
- context.beginPath();
- context.moveTo(471, 400);
- context.lineTo(518, 400);
- context.stroke();
- context.closePath();
- context.strokeStyle = '#663300';
- context.strokeRect(477, 180, 20, 43);
- context.strokeStyle = '#000000';
- context.save();
- context.translate(340, 56.5);
- context.scale(0.7586206896551724, 1);
- context.beginPath();
- context.arc(0, 0, 36, 0, 6.283185307179586, false);
- context.stroke();
- context.closePath();
- context.restore();
- }
- window.addEventListener("load", rysujDomek, true);
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement