Guest User

Untitled

a guest
Sep 25th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.41 KB | None | 0 0
  1. <!DOCTYPE html>
  2.  
  3.     <head>
  4.         <meta charset="utf-8" />
  5.         <title>Drawing images</title>
  6.         <script>
  7.         function retornarLienzo(x){
  8.                 var canvas = document.getElementById(x);
  9.                 if(canvas.getContext){
  10.                     var lienzo = canvas.getContext("2d");
  11.                     return lienzo;
  12.                 }else{
  13.                     return false;
  14.                 }
  15.             }
  16.             function inicio(){
  17.                 ini=setInterval(dibujar,20);
  18.             }
  19.             var contador=0;
  20.             var ini;
  21.        
  22.             function dibujar(){
  23.                 var lienzo=retornarLienzo("lienzo1");
  24.                 if(lienzo){
  25.                     lienzo.clearRect(0,0,300,300);
  26.                     lienzo.shadowOffsetX=30;
  27.                     lienzo.shadowOffsetY=30;
  28.                     lienzo.shadowBlur=contador;
  29.                     lienzo.shadowColor="rgba(255,0,0,0.5)";
  30.                     lienzo.fillStyle="rgb(255,0,0)";
  31.                     lienzo.fillRect(50,50,200,200);
  32.                     contador++;
  33.                     if(contador==100){
  34.                       clearInterval(ini);
  35.                     }
  36.                    }
  37.                   }  
  38.             </script>
  39.     </head>
  40.    <body onload="inicio()">
  41.         <canvas id="lienzo1" width="600" height="600">
  42.             tu navegador no soporta canvas
  43.         </canvas>
  44.     </body>
  45. </html>
Add Comment
Please, Sign In to add comment