Advertisement
Guest User

JestemDebilemHehehe

a guest
Dec 16th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="pl">
  3. <head>
  4. <meta charset="utf-8"> <title>Canvas</title>
  5. <script type="text/javascript">
  6. function draw()
  7. { var canvas = document.getElementById('image');
  8. var context = canvas.getContext('2d');
  9. context.fillStyle = 'yellow';
  10. context.fillRect(0,0,100,100);
  11. context.strokeRect(0,0,100,100);
  12. context.fillStyle = 'red';
  13. context.fillRect(30,30,30,30);
  14.  
  15.  
  16. context.beginPath();
  17. context.moveTo(50,50); context.lineTo(100,0);
  18. context.lineTo(150,50); context.lineTo(100,100); context.lineTo(50,50);
  19. context.fillStyle = 'green';
  20. context.fill();
  21. context. closePath();
  22.  
  23. context.beginPath();
  24. context.arc(200,200,80,Math.PI,0,false);
  25. context.closePath();
  26. context.lineWidth = 10;
  27. context.strokeStyle = "black";
  28. context.stroke();
  29.  
  30.  
  31. context.beginPath();
  32. context.moveTo(50,250); context.quadraticCurveTo(100,50,180,280);
  33. context.closePath();
  34. context.strokeStyle = "red";
  35. context.stroke();
  36.  
  37. image = new Image();
  38. image.src = "br.jpg";
  39. image.onload = function () {context.drawImage(image, 200,200,200,200); };
  40. image.fillStyle = "white";
  41. for (var i = 0; i < 1; i += 0.04) {
  42. context.globalAlpha = i;
  43. context.fillRect(0, i * 300, 350, 10); }
  44. }
  45.  
  46. </script>
  47. </head>
  48. <body onload="draw();">
  49. <canvas id="image" width="300" height="300">
  50. Twoja przeglądarka nie wspiera Canvas! Zainstaluj Internet Explorer 9.
  51. </canvas>
  52. </body>
  53. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement