-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
33 lines (28 loc) · 974 Bytes
/
app.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
angular.module('charGenerator', [])
.controller('CharGeneratorController', function() {
var generator = this;
generator.head = {
pics: ['img/head.gif', 'img/head2.gif'],
active: 0
};
generator.body = {
pics: ['img/body.gif', 'img/body2.gif'],
active: 0
};
generator.legs = {
pics: ['img/legs.gif', 'img/legs2.gif'],
active: 0
};
generator.next = function(bodyPart) {
if (generator[bodyPart].pics.length > generator[bodyPart].active + 1)
generator[bodyPart].active++;
else
generator[bodyPart].active = 0;
};
generator.prev = function(bodyPart) {
if (generator[bodyPart].active > 0)
generator[bodyPart].active--;
else
generator[bodyPart].active = generator[bodyPart].pics.length - 1;
};
});