-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathskeleton.js
More file actions
61 lines (49 loc) · 1.22 KB
/
skeleton.js
File metadata and controls
61 lines (49 loc) · 1.22 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
/**
* skeleton.js
*
*/
function Skeletons(ledstrip) {
this.ledstrip = ledstrip;
this.size = ledstrip.size();
this.count = 0;
// Initialize some sub-animations
this.skeletonss = [
new this.Skeleton(),
new this.Skeleton()
];
for (var idx = 0, len = this.skeletons.length; idx < len; ++idx) {
this.chasers[idx].parent = this;
}
}
Skeletons.prototype.init = function() {
}
Skeletons.prototype.animate = function() {
animation = requestAnimationFrame(this.animate.bind(this));
// slow things down. 1 == full speed
if ((this.count++ % 3)) return;
this.ledstrip.clear();
// Step through each sub-animation
for ( var i = 0; i < this.skeletons.length; i++ ) {
this.skeletons[i].step(this.ledstrip.buffer);
}
this.ledstrip.send();
}
/**
* SKELETON
*/
Skeletons.prototype.Skeleton = function() {
this.parent = {};
return this;
}
Skeletons.prototype.Skeleton.prototype.step = function(buf) {
this._step(this.parent.size);
this._draw(buf);
}
Skeletons.prototype.Skeleton.prototype._step = function(size) {
}
Skeletons.prototype.Skeleton.prototype._draw = function(buf) {
// Do something to fill the buffer
for (var i = 0; i < this.parent.length; i++) {
buf[i] = [128, 128, 128];
}
}