Commit e6a0affe by doszhang

dos

parent 444830b3
...@@ -450,24 +450,24 @@ function showCountDownPage() { ...@@ -450,24 +450,24 @@ function showCountDownPage() {
} }
function countDown(callback) { function countDown(callback) {
let angle = -360; let angle = 360;
let countdown = 3; let countdown = 3;
let timer; let timer;
countDownCtx.fillStyle = bgColor; countDownCtx.fillStyle = bgColor;
timer = setInterval(function () { timer = setInterval(function () {
$('.countdown-num').text(countdown).addClass('animate'); $('.countdown-num').text(countdown).addClass('animate');
angle = ((angle * 10) + 36) / 10; angle = ((angle * 10) - 36) / 10;
countDownCtx.clearRect(0, 0, countDownCanvas.width, countDownCanvas.height);
countDownCtx.sector(countDownCanvas.width / 2, countDownCanvas.height / 2, countDownCanvas.width / 2, 1.5, angle).fill(); countDownCtx.sector(countDownCanvas.width / 2, countDownCanvas.height / 2, countDownCanvas.width / 2, 0, angle).fill();
if (angle >= 0) { if (angle <= 0) {
countdown--; countdown--;
if (countdown == 0) { if (countdown == 0) {
clearInterval(timer); clearInterval(timer);
callback(); callback();
} else { } else {
countDownCtx.clearRect(0, 0, countDownCanvas.width, countDownCanvas.height);
angle = -360; angle = 360;
$('.countdown-num').text(countdown); $('.countdown-num').text(countdown);
} }
} }
...@@ -825,7 +825,7 @@ CanvasRenderingContext2D.prototype.sector = function (x, y, r, angle1, angle2) { ...@@ -825,7 +825,7 @@ CanvasRenderingContext2D.prototype.sector = function (x, y, r, angle1, angle2) {
this.save(); this.save();
this.beginPath(); this.beginPath();
this.moveTo(x, y); this.moveTo(x, y);
this.arc(x, y, r, angle1 * Math.PI, angle2 * Math.PI, false); this.arc(x, y, r, angle1 * Math.PI / 180, angle2 * Math.PI / 180, true);
this.closePath(); this.closePath();
this.restore(); this.restore();
return this; return this;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment