hextris/js/Text.js

33 lines
568 B
JavaScript
Raw Normal View History

2014-05-26 16:27:30 +00:00
function Text(x,y,text,font,color,incrementFunction){
this.x = x;
this.y = y;
this.font = font;
this.color = color;
this.opacity =1;
this.text = text;
this.draw = function(){
if(this.opacity>0){
ctx.font= this.font;
ctx.fillStyle = this.color;
ctx.globalAlpha = this.opacity;
ctx.fillText(text,this.x,this.y);
ctx.globalAlpha =1;
2014-05-26 16:27:30 +00:00
//this.opacity = 1-(Date.now()-MainClock.lastCombo)/5000;
incrementFunction(this);
return true;
}
else{
return false;
}
}
}
2014-05-26 16:27:30 +00:00
function fadeUpAndOut(text){
text.opacity -=0.05;
text.y-=3;
}