Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
FogNetwork
GitHub Repository: FogNetwork/Tsunami
Path: blob/main/public/games/files/hextris/js/Text.js
1036 views
1
function Text(x,y,text,font,color,incrementFunction){
2
this.x = x;
3
this.y = y;
4
this.font = font;
5
this.color = color;
6
this.opacity =1;
7
this.text = text;
8
this.alive=1;
9
this.draw = function(){
10
if (this.alive>0) {
11
ctx.globalAlpha = this.opacity;
12
renderText((this.x + gdx), (this.y + gdy),50,this.color,this.text);
13
ctx.globalAlpha =1;
14
incrementFunction(this);
15
return true;
16
}
17
else {
18
return false;
19
}
20
};
21
}
22
23
function fadeUpAndOut(text){
24
text.opacity -= MainHex.dt * Math.pow(Math.pow((1-text.opacity), 1/3)+1,3)/100;
25
text.alive = text.opacity;
26
text.y -= 3 * MainHex.dt;
27
}
28
29