-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquad.js
More file actions
29 lines (22 loc) · 756 Bytes
/
quad.js
File metadata and controls
29 lines (22 loc) · 756 Bytes
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
// quad is assembled from other quads unless it is an atomicquad
var Quad = Backbone.Model.extend4000( GraphNode, Vector,
{
defaults: { size: 1 },
indexToPos: function(i) {
if (i == 0) { return makeV(-1, 1) }
if (i == 1) { return makeV( 1, 1) }
if (i == 2) { return makeV( 1,-1) }
if (i == 3) { return makeV(-1,-1) }
},
})
var NothingQuad = Quad.extend4000({
explode: function() {
if (!this.children.length) {
var size = this.get('size') / 2
var self = this;
_.times(4, function () { self.addchild(new Quad({size: size})) } )
this.trigger('explode')
}
return this.children
}
})