• 刮刮奖


     1 <!DOCTYPE html>
     2 <html>
     3 <head>
     4     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     5     <title>刮刮奖</title>
     6     <meta name="viewport" content="initial-scale=1.0, width=device-width,minimum-scale=1.0,maximum-scale=1.0, user-scalable=no" />
     7     <style type="text/css">
     8         body{
     9             margin: 0;
    10         }
    11         .wrap {
    12             width: 320px;
    13             height: 400px;
    14             background: url('thumb-6.jpg') 0 0 no-repeat;
    15             background-size: cover;
    16         }
    17     </style>
    18 </head>
    19 <body>
    20     <div id="con" class="wrap">
    21         <canvas id="myCanvas" width="320" height="400"></canvas>
    22     </div>
    23 
    24     <script type="text/javascript" src="jquery-2.0.3.min.js"></script>
    25     <script type="text/javascript">
    26         $(function(){
    27             //创建画布
    28             var myCanvas =  document.getElementById('myCanvas');
    29             var gray = myCanvas.getContext('2d');
    30             //创建灰色层
    31             gray.beginPath();
    32             gray.fillStyle = "#999";
    33             gray.fillRect(0,0,320,400);
    34             gray.closePath();
    35             gray.globalCompositeOperation="destination-out";
    36             //画布绑定touch事件,在touchmove的时候进行画布的清除
    37             myCanvas.addEventListener('touchstart', function (e) {
    38                 myCanvas.addEventListener('touchmove', function(e){
    39                     gray.beginPath();
    40                     gray.fillStyle = "#f00";
    41                     gray.arc(e.targetTouches[0].clientX, e.targetTouches[0].clientY, 20, 0, Math.PI*2);
    42                     gray.fill();
    43                     gray.closePath();
    44                 });
    45             })
    46 
    47 
    48         })
    49     </script>
    50 </body>
    51 </html>
  • 相关阅读:
    poj2411 状压dp
    棋盘覆盖TYVJ1035(二分图最大匹配)
    poj3417
    无向图边双+缩点
    无向图点双+缩点
    bzoj1123(割点加路径统计)
    【BZOJ1178】会议中心(APIO2009)-贪心+倍增+set
    【BZOJ4650】优秀的拆分(NOI2016)-后缀数组+RMQ+差分
    【BZOJ4569】萌萌哒(SCOI2016)-并查集+倍增
    【BZOJ2208】连通数(JSOI2010)-SCC+DP+bitset
  • 原文地址:https://www.cnblogs.com/zhanghuiyun/p/5703940.html
Copyright © 2020-2023  润新知