2014-05-26 16:27:30 +00:00
|
|
|
function Text(x,y,text,font,color,incrementFunction){
|
2014-05-26 15:22:52 +00:00
|
|
|
this.x = x;
|
|
|
|
this.y = y;
|
|
|
|
this.font = font;
|
|
|
|
this.color = color;
|
|
|
|
this.opacity =1;
|
|
|
|
this.text = text;
|
2014-05-26 17:18:27 +00:00
|
|
|
this.alive=1;
|
2014-05-26 15:22:52 +00:00
|
|
|
|
|
|
|
this.draw = function(){
|
2014-05-26 17:18:27 +00:00
|
|
|
if(this.alive>0){
|
2014-05-26 15:22:52 +00:00
|
|
|
ctx.font= this.font;
|
|
|
|
ctx.fillStyle = this.color;
|
|
|
|
ctx.globalAlpha = this.opacity;
|
2014-05-31 14:55:36 +00:00
|
|
|
ctx.fillText(this.text,this.x+gdx,this.y+gdy);
|
2014-05-26 15:22:52 +00:00
|
|
|
ctx.globalAlpha =1;
|
2014-05-26 16:27:30 +00:00
|
|
|
//this.opacity = 1-(Date.now()-MainClock.lastCombo)/5000;
|
|
|
|
incrementFunction(this);
|
|
|
|
return true;
|
|
|
|
}
|
2014-05-31 14:55:36 +00:00
|
|
|
else {
|
2014-05-26 16:27:30 +00:00
|
|
|
return false;
|
2014-05-26 15:22:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2014-05-26 16:27:30 +00:00
|
|
|
|
|
|
|
function fadeUpAndOut(text){
|
2014-05-26 18:14:30 +00:00
|
|
|
text.opacity -= Math.pow(Math.pow((1-text.opacity), 1/3)+1,3)/100;
|
2014-05-26 17:18:27 +00:00
|
|
|
text.alive = text.opacity;
|
2014-05-26 16:27:30 +00:00
|
|
|
text.y-=3;
|
|
|
|
}
|
2014-05-26 16:45:52 +00:00
|
|
|
|