js实现canvas大转盘代码
代码语言:html
所属分类:大转盘
代码描述:js实现canvas大转盘代码,可自定义抽奖概率与抽奖选项
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width,height=device-height,initial-scale=1,minimum-scale=1,user-scalable=no"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery.1.11.min.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/turntable.js"></script> <title></title> <style> .lottery { position: relative; display: inline-block; } .lottery img { position: absolute; top: 50%; left: 50%; margin-left: -76px; margin-top: -82px; cursor: pointer; } #message { position: absolute; top: 0px; left: 10%; } </style> </head> <body> <div class="lottery"> <canvas id="myCanvas" width="600" height="600" style="border:1px solid #d3d3d3;"> 当前浏览器版本过低,请使用其他浏览器尝试 </canvas> <p id="message"></p> <img src="//repo.bfw.wiki/bfwrepo/image/613c579135954.png" id="start"> </div> <script> var wheelSurf // 初始化装盘数据 正常情况下应该由后台返回 var initData = { "success": true, "list": [{ "id": 100, "name": "5000元京东卡", "image": "//repo.bfw.wiki/bfwrepo/images/zhuanpan/zhuanimg/1.png", "rank":1, "percent":3 }, { "id": 101, "name": "1000元京东卡", "image": "//repo.bfw.wiki/bfwrepo/images/zhuanpan/zhuanimg/2.png", "rank":2, "percent":5 }, { "id": 102, "name": "100个比特币", "image": "//repo.bfw.wiki/bfwrepo/images/zhuanpan/zhuanimg/3.png", "rank":3, "percent":2 }, { "id": 103, "name": "50元话费", "image": "//repo.bfw.wiki/bfwrepo/images/zhuanpan/zhuanimg/4.png", "rank":4, "percent":49 }, { "id": 104, "name": "100元话费", "image": "//repo.bfw.wiki/bfwrepo/images/zhuanpan/zhuanimg/5.png", "rank":5, "percent":30 }, { "id": 105, "name": "500个比特币", .........完整代码请登录后点击上方下载按钮下载查看
网友评论0