Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title>Multimedia i interfejsy</title>
- <link href="css/video.css" rel="stylesheet" type="text/css">
- <meta charset="utf-8">
- <script type="text/javascript">
- var mycanvas;
- var ctx;
- var obrot;
- function load() {
- mycanvas = document.getElementById("myCanvas");
- ctx = mycanvas.getContext('2d');
- var grad = ctx.createLinearGradient(0, 0,mycanvas.width, mycanvas.height);
- grad.addColorStop(0, 'rgb(0 , 255, 0)');
- grad.addColorStop(1, 'rgba(0, 0, 255, 0.5)');
- ctx.fillStyle = grad;
- ctx.fillRect(0,0,mycanvas.width,mycanvas.height);
- ctx.drawImage(widelo,10,10,mycanvas.width-20, mycanvas.height-20);
- ctx.beginPath();
- ctx.arc(5, 5, 5, 0, Math.PI*2, false);
- ctx.stroke();
- obrot=0.0;
- }
- function marchewka()
- {
- mycanvas = document.getElementById("myCanvas");
- ctx = mycanvas.getContext('2d');
- ctx.fillStyle = 'rgb(255,255,255)'; //rodzaj wypełnienia
- ctx.fillRect(0,0,mycanvas.width,mycanvas.height);
- ctx.translate(mycanvas.width/2, mycanvas.height/2);
- ctx.rotate(-obrot);
- ctx.translate(-mycanvas.width/2, -mycanvas.height/2);
- ctx.fillStyle = 'rgb(255,255,255)'; //rodzaj wypełnienia
- ctx.fillRect(0,0,mycanvas.width,mycanvas.height);
- obrot=obrot+0.3;
- ctx.translate(mycanvas.width/2, mycanvas.height/2);
- ctx.rotate(obrot);
- ctx.translate(-mycanvas.width/2, -mycanvas.height/2);
- ctx.fillStyle = 'rgb(255,255,255)'; //rodzaj wypełnienia
- ctx.fillRect(0,0,mycanvas.width,mycanvas.height);
- var grad = ctx.createLinearGradient(0, 0,mycanvas.width, mycanvas.height);
- grad.addColorStop(0, 'rgb(0 , 255, 0)');
- grad.addColorStop(1, 'rgba(0, 0, 255, 0.5)');
- ctx.fillStyle = grad;
- ctx.fillRect(0,0,mycanvas.width,mycanvas.height);
- ctx.drawImage(widelo,10,10,mycanvas.width-20, mycanvas.height-20);
- ctx.beginPath();
- ctx.arc(5, 5, 5, 0, Math.PI*2, false);
- ctx.stroke();
- }
- </script>
- </head>
- <body onload = "load();">
- <h1>Multimedia i interfejsy - HTML5</h1>
- <div id="div_video">
- <p>video</p>
- <video id="widelo" width = “320” height = "240" controls = "controls">
- <source src = "video.webm" type ="video/webm">
- Przeglądarka nie obsługuje elementu video.
- </video>
- </div>
- <div id="div_canvas" >
- <p>canvas</p>
- <canvas id="myCanvas" width="320" height="240" onclick="marchewka()" >
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment