参数设置:
var turnplate = { restaraunts: [], //大转盘奖品名称 colors: [], //大转盘奖品区块对应背景颜色 outsideRadius: 192, //大转盘外圆的半径 textRadius: 155, //大转盘奖品位置距离圆心的距离 insideRadius: 68, //大转盘内圆的半径 startAngle: 0, //开始角度 bRotate: false //false:停止;ture:旋转 }; //控制中奖结果方法 function rnd(n, m) { var random = 11; //var random = Math.floor(Math.random()*(m-n+1)+n); return random; } 随机中奖结果: rotateFn(item, turnplate.restaraunts[item - 1]); 根据停止角度指定中奖结果: /* switch (item) { case 1: rotateFn(252, turnplate.restaraunts[0]); break; case 2: rotateFn(216, turnplate.restaraunts[1]); break; case 3: rotateFn(180, turnplate.restaraunts[2]); break; case 4: rotateFn(144, turnplate.restaraunts[3]); break; case 5: rotateFn(108, turnplate.restaraunts[4]); break; case 6: rotateFn(72, turnplate.restaraunts[5]); break; case 7: rotateFn(36, turnplate.restaraunts[6]); break; case 8: rotateFn(360, turnplate.restaraunts[7]); break; case 9: rotateFn(324, turnplate.restaraunts[8]); break; case 10: rotateFn(288, turnplate.restaraunts[9]); break; } */