-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWord.js
More file actions
33 lines (28 loc) · 787 Bytes
/
Word.js
File metadata and controls
33 lines (28 loc) · 787 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
30
31
32
33
function Word(string, x, y, z, depth, size, resolution, bevelled = true, font = "Georgia", style = BOLD) {
this.string = string;
this.pos = createVector(x, y, z);
this.depth = depth;
this.size = size;
this.res = resolution;
this.bevelled = bevelled;
this.font = font;
this.style = style;
this.create = function() {
var array = [];
for (var i = 0; i < string.length; i++) {
// Centre the word
var mod = string.length/2 - 0.5
var temp = new Letter(
string[i], this.pos.x + (i-mod)*this.size*this.res, this.pos.y, this.pos.z, this.depth, this.size, this.res, this.bevelled, this.font, this.style
)
array.push(temp)
}
this.letters = array;
}
this.create()
this.show = function() {
for(var letter of this.letters) {
letter.show()
}
}
}