desdemona

mii lab html5

Dec 6th, 2012
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 2.41 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.  
  4. <head>
  5.     <title>Multimedia i interfejsy</title>
  6.  
  7.     <link href="css/video.css" rel="stylesheet" type="text/css">
  8.  
  9.     <meta charset="utf-8">
  10.  
  11. <script type="text/javascript">
  12.  
  13.     var mycanvas;
  14.     var ctx;
  15.     var obrot;
  16.  
  17.     function load() {
  18.    
  19.         mycanvas = document.getElementById("myCanvas");
  20.         ctx = mycanvas.getContext('2d');
  21.         var grad = ctx.createLinearGradient(0, 0,mycanvas.width, mycanvas.height);
  22.         grad.addColorStop(0, 'rgb(0 , 255, 0)');
  23.         grad.addColorStop(1, 'rgba(0, 0, 255, 0.5)');
  24.         ctx.fillStyle = grad;
  25.         ctx.fillRect(0,0,mycanvas.width,mycanvas.height);
  26.        
  27.  
  28.  
  29.  
  30.         ctx.drawImage(widelo,10,10,mycanvas.width-20, mycanvas.height-20);
  31.         ctx.beginPath();
  32.         ctx.arc(5, 5, 5, 0, Math.PI*2, false);     
  33.         ctx.stroke();
  34.         obrot=0.0;
  35.        
  36.        
  37.     }
  38.    
  39.     function marchewka()
  40.     {
  41.         mycanvas = document.getElementById("myCanvas");
  42.  
  43.         ctx = mycanvas.getContext('2d');
  44.         ctx.fillStyle = 'rgb(255,255,255)'; //rodzaj wypełnienia
  45.         ctx.fillRect(0,0,mycanvas.width,mycanvas.height);
  46.        
  47.         ctx.translate(mycanvas.width/2, mycanvas.height/2);
  48.         ctx.rotate(-obrot);
  49.         ctx.translate(-mycanvas.width/2, -mycanvas.height/2);  
  50.         ctx.fillStyle = 'rgb(255,255,255)'; //rodzaj wypełnienia
  51.         ctx.fillRect(0,0,mycanvas.width,mycanvas.height);
  52.  
  53.         obrot=obrot+0.3;
  54.         ctx.translate(mycanvas.width/2, mycanvas.height/2);
  55.         ctx.rotate(obrot);
  56.         ctx.translate(-mycanvas.width/2, -mycanvas.height/2);
  57.         ctx.fillStyle = 'rgb(255,255,255)'; //rodzaj wypełnienia
  58.         ctx.fillRect(0,0,mycanvas.width,mycanvas.height);
  59.        
  60.        
  61.        
  62.         var grad = ctx.createLinearGradient(0, 0,mycanvas.width, mycanvas.height);
  63.         grad.addColorStop(0, 'rgb(0 , 255, 0)');
  64.         grad.addColorStop(1, 'rgba(0, 0, 255, 0.5)');
  65.         ctx.fillStyle = grad;
  66.         ctx.fillRect(0,0,mycanvas.width,mycanvas.height);
  67.        
  68.         ctx.drawImage(widelo,10,10,mycanvas.width-20, mycanvas.height-20);
  69.         ctx.beginPath();
  70.         ctx.arc(5, 5, 5, 0, Math.PI*2, false);     
  71.         ctx.stroke();
  72.     }
  73.  
  74. </script>
  75.  
  76. </head>
  77.  
  78. <body onload = "load();">
  79.  
  80.     <h1>Multimedia i interfejsy - HTML5</h1>
  81.  
  82.     <div id="div_video">  
  83.         <p>video</p>
  84.         <video id="widelo" width = “320” height = "240" controls = "controls">
  85. <source src = "video.webm" type ="video/webm">
  86. Przeglądarka nie obsługuje elementu video.
  87. </video>
  88.     </div>
  89.  
  90.     <div id="div_canvas" > 
  91.         <p>canvas</p>
  92.         <canvas id="myCanvas" width="320" height="240" onclick="marchewka()" >
  93.     </div>
  94.  
  95. </body>
  96. </html>
Advertisement
Add Comment
Please, Sign In to add comment