RotaryDraw

功能描述

实现了大转盘、抽奖类小游戏的制作,开发者可以自定义样式

依赖模块

./libs/choujiang.js

快速使用

JS调用

  1. var lottery = new LotteryDial(document.getElementById('js_pointer'), {
  2. speed: 30, // 每帧速度
  3. areaNumber: 8 // 奖区数量
  4. })
  5. var index = -1
  6. lottery.on('start', function () {
  7. // 请求获取中奖结果
  8. index = Math.round(Math.random() * 7)
  9. lottery.setResult(index)
  10. })
  11. lottery.on('end', function () {
  12. console.log('中奖奖区:' + index)
  13. })

特别说明

样式修改详见css/style.css,用例详见 rotarydraw.html。