-
Notifications
You must be signed in to change notification settings - Fork 1
/
text.js
29 lines (22 loc) · 835 Bytes
/
text.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
var makeText = function () {
var size = 48;
var hidden = false;
return {
draw: function () {
if (hidden && size <= 30) return;
var fillColor = "#cc";
var t = Math.floor(Math.sin(FRAME/1.5) * 32.5);
fillColor += Math.floor(32 + t/3).toString(16);
fillColor += (180 + t).toString(16);
context.save();
context.fillStyle = fillColor;
context.globalAlpha = 1 * (size - 30) / 18;
context.font = +(size) + "px Penshurst";
t = context.measureText("DASH (X) ! ! !").width;
context.fillText("DASH (X) ! ! !", (WIDTH - t) / 2, HEIGHT * 0.8);
context.restore();
if (hidden && size > 30) size -= 2;
},
hide: function () { hidden = true; },
}
};