-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstartext.js
More file actions
61 lines (61 loc) · 2.53 KB
/
startext.js
File metadata and controls
61 lines (61 loc) · 2.53 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Decorators;
(function (Decorators) {
var StarText = (function (_super) {
__extends(StarText, _super);
function StarText() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.margin = 5;
_this.ti = 0.6;
return _this;
}
StarText.prototype.init = function (content) {
var textContainer = new PIXI.Container();
var textSample = new PIXI.Text(content, {
fontFamily: 'Arial',
fontSize: 13,
fill: 'black',
align: 'left'
});
textSample.y = 0 - textSample.height / 2 + this.margin;
textSample.x = this.margin;
this.textwidth = textSample.width;
var g = new PIXI.Graphics();
g.beginFill(0xcccccc);
g.drawRoundedRect(0, -textSample.height / 2, textSample.width + 3 * this.margin, textSample.height + 2 * this.margin, 5);
g.endFill();
textContainer.addChild(g);
textContainer.addChild(textSample);
this.addChild(textContainer);
textContainer.alpha = 0;
textContainer.name = "textContainer";
var s = new PIXI.Sprite(PIXI.Texture.fromImage("Star.png"));
s.anchor.set(0.5);
s.scale.set(0.01);
this.addChild(s);
var timeline = new TimelineMax();
timeline.add(TweenLite.to(textContainer, this.ti, { alpha: 0 }));
timeline.add(TweenLite.to(s, this.ti, {
x: textSample.width + 3 * this.margin,
y: -textSample.height / 2, ease: Bounce.easeOut
}));
timeline.add(TweenLite.to(textContainer, this.ti, { alpha: 1, ease: Power3.easeOut }), "=-" + this.ti);
timeline.play();
this.timeline = timeline;
};
StarText.prototype.destroy = function () {
var t = this.timeline;
if (t != null) {
t.kill();
this.timeline = null;
}
};
return StarText;
}(PIXI.Container));
Decorators.StarText = StarText;
})(Decorators || (Decorators = {}));
//# sourceMappingURL=startext.js.map