久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      html5實現(xiàn)一個簡單的在線畫板

      html5實現(xiàn)一個簡單的在線畫板

      我們先來看看實現(xiàn)效果:

      (推薦教程:h5)

      html5實現(xiàn)一個簡單的在線畫板

      實現(xiàn)代碼如下:

      <!DOCTYPE html> <html>     <head>         <meta charset="UTF-8">         <title></title>     </head>     <body>         <canvas id="canvas" width="600" height="600"></canvas>         <script type="text/javascript">             var c = document.getElementById('canvas');             var ctx = c.getContext('2d');              //畫一個黑色矩形             ctx.fillStyle = 'black';             ctx.fillRect(0,0,600,300);              //按下標記             var onoff = false;             var oldx = -10;             var oldy = -10;              //設置顏色             var linecolor = 'white';              //設置線寬             var linw = 4;              //添加鼠標移動事件             canvas.addEventListener('mousemove',draw,true);              //添加鼠標按下事件             canvas.addEventListener('mousedown',down,false);              //添加鼠標彈起事件             canvas.addEventListener('mouseup',up,false);              function down(event) {                 onoff = true;                 oldx = event.pageX-10;                 oldy = event.pagey-10;             }              function up() {                 onoff = false;             }              function draw(event) {                 if(onoff == true) {                     var newx = event.pageX-10;                     var newy = event.pageY-10;                     ctx.beginPath();                     ctx.moveTo(oldx,oldy);                     ctx.lineTo(newx,newy);                     ctx.strokeStyle = linecolor;                     ctx.lineCap = 'round';                     ctx.stroke();                      oldx = newx;                     oldy = newy;                 }             }         </script>     </body> </html>

      免費學習視頻分享:html視頻教程

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號