中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

HTML5 Canvas 制作一個“在線畫板”

2018-07-20    來源:open-open

容器云強(qiáng)勢上線!快速搭建集群,上萬Linux鏡像隨意使用
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <script src="Jquery1.7.js"></script>
    <style type="text/css">
      #php100{ border:1px solid #ccc;}
    </style>
    <script type="text/javascript">
        var canvas = document.getElementById('php100');
        var p100=canvas.getContext("2d");
        p100.lineWidth=10
        p100.strokeStyle="red";
        var pp=false;


        $(function () {
            $("#php100").mousedown(function (e) {
                var mouseX = e.pageX - this.offsetLeft;
                var mouseY = e.pageY - this.offsetTop;
                pp = true;
                p100.moveTo(mouseX, mouseY); //起始位置


            })
            //當(dāng)鼠標(biāo)抬起時
            $("#php100").mouseup(function(e){
                pp=false;
            });
 
            //當(dāng)鼠標(biāo)移動時
            $("#php100").mousemove(function(e){
  
                var mouseX = e.pageX - this.offsetLeft;
                var mouseY = e.pageY - this.offsetTop;
                if(pp){
                    p100.lineTo(mouseX,mouseY); //終止位置
                    p100.stroke(); //結(jié)束圖形
                }
            })
        })


    </script>


</head>
<body>
    <canvas id="php100" width="500" height="400"></canvas>


</body>
</html>

標(biāo)簽:

版權(quán)申明:本站文章部分自網(wǎng)絡(luò),如有侵權(quán),請聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點(diǎn)!
本站所提供的圖片等素材,版權(quán)歸原作者所有,如需使用,請與原作者聯(lián)系。

上一篇:各種語言對圖片的處理算法實(shí)現(xiàn) 圖片模糊實(shí)現(xiàn)代碼

下一篇:公歷農(nóng)歷互相轉(zhuǎn)換的Java日歷工具類