Hakunin

SKI_V2

Oct 31st, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 3.11 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>Title</title>
  6. </head>
  7. <body>
  8. <canvas id="mojokvir" width="600" height="400" style="border:1px solid #000000">
  9.     <!-- unutar canvas koordinate su u americkom stilu... -->
  10.     <script>
  11.         var c = document.getElementById("mojokvir");
  12.         var ctx = c.getContext("2d");
  13.  
  14.         ctx.fillStyle="#ff0000";
  15.         ctx.fillRect(0,0,150,100);
  16.  
  17.         ctx.fillStyle="#8328ff";
  18.         ctx.fillRect(150,100,250,200);
  19.  
  20.         grd=ctx.createLinearGradient(250,0,350,100); <!--gradijent pod uglom-->
  21.         grd.addColorStop(0.5,"blue");
  22.         grd.addColorStop(1,"green");
  23.         ctx.fillStyle=grd;
  24.         ctx.fillRect(250,0,350,100);
  25.  
  26.         ctx.beginPath();
  27.         ctx.moveTo(100,100); <!-- pomera beginpath do 100 100 -->
  28.         ctx.lineTo(200,200); <!-- linija ide do -->
  29.         ctx.lineTo(340,120);
  30.         ctx.closePath();
  31.         grd2=ctx.createLinearGradient(100,100,180,50);
  32.         grd2.addColorStop(0.5,"red");
  33.         grd2.addColorStop(1,"yellow");
  34.         ctx.fillStyle=grd2;
  35.         ctx.fill();  /*puni linepath (ili bilo sta)*/
  36.         ctx.stroke();
  37.  
  38.         ctx.font="18px Arial";
  39.         ctx.save();
  40.         ctx.fillStyle="#00ffff"
  41.         ctx.textAlign="start"; /*end - pozicija gde se zavrsava tekst, kad je start tamo gde pocinje tekst*/
  42.         ctx.shadowColor="gray";
  43.         ctx.shadowOffsetX=4;
  44.         ctx.shadowOffsetY=5;
  45.         ctx.shadowBlur=3;
  46.         ctx.rotate(-(Math.PI/180)*5)
  47.         ctx.fillText("TEKSTUALNI POPUNJENI TEKST",50,50);
  48.         ctx.strokeText("TEKSTUALNI SKROL TEKST", 300,300);
  49.         for(i = 100;i < 500;i+=35){
  50.            ctx.fillText("TEKSTUALNI POPUNJENI TEKST",i,i);
  51.            ctx.strokeText("TEKSTUALNI SKROL TEKST", i+50,i+50);
  52.        }
  53.        ctx.restore();
  54.        ctx.fillText("EVERY DAY WE STRAY FURTHER FROM GOD", 10 ,400)
  55.  
  56.    </script>
  57. </canvas>
  58. </body>
  59. </html>
  60.  
  61.  
  62.  
  63. ///////////////////////////////////////////////vezba2 zadatak
  64.  
  65. <!DOCTYPE html>
  66. <html lang="en">
  67. <head>
  68.     <meta charset="UTF-8">
  69.     <title>Title</title>
  70. </head>
  71. <body>
  72.  
  73. <canvas id="mojokvir" width="300" height="300" style="border:1px solid #000000">
  74.     <script>
  75.         var c = document.getElementById("mojokvir");
  76.         var ctx = c.getContext("2d");
  77.  
  78.         ctx.beginPath();
  79.         ctx.moveTo(100,100); <!-- pomera beginpath do 100 100 -->
  80.         ctx.lineTo(200,100); <!-- linija ide do -->
  81.         ctx.lineTo(200,200);
  82.         ctx.closePath();
  83.         grd2=ctx.createLinearGradient(100,100,200,200);
  84.         grd2.addColorStop(0.5,"green");
  85.         grd2.addColorStop(1,"yellow");
  86.         ctx.fillStyle=grd2;
  87.         ctx.fill();
  88.  
  89.         ctx.beginPath();
  90.         ctx.moveTo(100,100); <!-- pomera beginpath do 100 100 -->
  91.         ctx.lineTo(100,200); <!-- linija ide do -->
  92.         ctx.lineTo(200,200);
  93.         ctx.closePath();
  94.         ctx.fillStyle="red";
  95.         ctx.fill()
  96.  
  97.         ctx.fillStyle="black";
  98.         ctx.rotate(-(Math.PI/180)*5)
  99.         ctx.font="18px Arial";
  100.         ctx.fillText("TEKST1",200,100);
  101.  
  102.     </script>
  103. </canvas>
  104. </body>
  105. </html>
Advertisement
Add Comment
Please, Sign In to add comment