Commit 2729441a by doszhang

dos

parent 39ea15f6
...@@ -27,6 +27,12 @@ ...@@ -27,6 +27,12 @@
* *
* @constructor * @constructor
*/ */
var defindX = 0;
var defindY = 0;
var timerStatus = false;
var timer = null;
function LuckyCard(settings, callback) { function LuckyCard(settings, callback) {
this.cover = null; this.cover = null;
this.ctx = null; this.ctx = null;
...@@ -98,19 +104,30 @@ ...@@ -98,19 +104,30 @@
var pageScrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft; var pageScrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
var mouseX = evt.pageX - coverPos.left - pageScrollLeft; var mouseX = evt.pageX - coverPos.left - pageScrollLeft;
var mouseY = evt.pageY - coverPos.top - pageScrollTop; var mouseY = evt.pageY - coverPos.top - pageScrollTop;
defineX = mouseX;
defindY = mouseY;
if(!timerStatus)
{
timer = setInterval(fillCircle,1);
}
};
function fillCircle()
{
this.ctx.beginPath(); this.ctx.beginPath();
this.ctx.fillStyle = '#FFFFFF'; this.ctx.fillStyle = '#FFFFFF';
this.ctx.globalCompositeOperation = "destination-out"; this.ctx.globalCompositeOperation = "destination-out";
this.ctx.arc(mouseX, mouseY, 10, 0, 2 * Math.PI); this.ctx.arc(defineX, defindY, 10, 0, 2 * Math.PI);
this.ctx.fill(); this.ctx.fill();
}; }
/** /**
* touchend/mouseup event handler * touchend/mouseup event handler
*/ */
function _endEventHandler(event) { function _endEventHandler(event) {
event.preventDefault(); event.preventDefault();
timerStatus = false;
if (this.opt.callback && typeof this.opt.callback === 'function') _calcArea.call(this,this.ctx, this.opt.callback, this.opt.ratio); if (this.opt.callback && typeof this.opt.callback === 'function') _calcArea.call(this,this.ctx, this.opt.callback, this.opt.ratio);
this.cover.removeEventListener(this.events[1],this.moveEventHandler,false); this.cover.removeEventListener(this.events[1],this.moveEventHandler,false);
document.removeEventListener(this.events[2],this.endEventHandler,false); document.removeEventListener(this.events[2],this.endEventHandler,false);
......
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