1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/hextris_ynh.git synced 2024-09-03 19:16:05 +02:00
hextris_ynh/sources/js/Text.js
2014-08-18 18:37:19 +02:00

27 lines
582 B
JavaScript

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.alive=1;
this.draw = function(){
if (this.alive>0) {
ctx.globalAlpha = this.opacity;
renderText((this.x + gdx), (this.y + gdy),50,this.color,this.text);
ctx.globalAlpha =1;
incrementFunction(this);
return true;
}
else {
return false;
}
};
}
function fadeUpAndOut(text){
text.opacity -= Math.pow(Math.pow((1-text.opacity), 1/3)+1,3)/100;
text.alive = text.opacity;
text.y-=3;
}