-
Notifications
You must be signed in to change notification settings - Fork 2
/
timeline.js
38 lines (31 loc) · 1.21 KB
/
timeline.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
29
30
31
32
33
34
35
36
37
38
class TimelinePanel {
constructor(x, y, width, height) {
this.panelOffset = 200;
this.area = new Rectangle(x, $(window).height()-height, width, height);
this.timepanel = new Rectangle(x + this.panelOffset, $(window).height()-height+32, width, 150);
this.active = false;
this.length = 0; // Length of active animation
this.process = () => {
if (window.clicked) {
if (this.area.pointInside(Mouse.x, Mouse.y))
this.active = true;
else
this.active = false;
}
}
this.draw = () => {
this.area.draw("#262626", true, false);
// Draw time panel
this.timepanel.draw("#212121", true, false);
if (this.active)
this.area.draw("#3399cc", false, true);
for (var i = 0; i < 50; i++) {
var x = this.panelOffset + i * 75;
var h = 17;
//if (game.resourcesLoaded)
if (typeof timespacing !== "undefined")
Context.context.drawImage(timespacing.image, x, this.area.y + 15, 75, h);
}
}
}
};