-
Notifications
You must be signed in to change notification settings - Fork 0
/
Neck.js
37 lines (31 loc) · 1.05 KB
/
Neck.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
class Neck {
constructor(container, imageFile, speed, animationManager) {
this.container = container;
this.imageFile = imageFile;
this.speed = speed;
this.am = animationManager;
this._initDepthOcclusion();
// After one second start the fretboard
setTimeout(()=>{this.spawnMore()},1000);
}
// Creates two elements, a black block and a transparency gradient.
// These help to create the illusion of the fretboard disappearing into the
// background.
_initDepthOcclusion () {
let transparencyGradient = document.createElement("div");
transparencyGradient.className += "topBlur";
this.container.appendChild(transparencyGradient);
let black = document.createElement("div");
black.className += "topBlock";
this.container.appendChild(black);
}
spawnMore() {
let f = new Fret(
this.container,
this.imageFile,
this.speed,
()=>{this.spawnMore()}
);
this.am.add(f);
}
}