-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplay.js
More file actions
44 lines (43 loc) · 1.03 KB
/
play.js
File metadata and controls
44 lines (43 loc) · 1.03 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
var words = ['Book Your', 'Train', 'Explore the world', 'Check tours'],
part,
i = 0,
offset = 0,
len = words.length,
forwards = true,
skip_count = 0,
skip_delay = 15,
speed = 70;
var wordflick = function() {
setInterval(function() {
if (forwards) {
if (offset >= words[i].length) {
++skip_count;
if (skip_count == skip_delay) {
forwards = false;
skip_count = 0;
}
}
} else {
if (offset == 0) {
forwards = true;
i++;
offset = 0;
if (i >= len) {
i = 0;
}
}
}
part = words[i].substr(0, offset);
if (skip_count == 0) {
if (forwards) {
offset++;
} else {
offset--;
}
}
$('.word').text(part);
}, speed);
};
$(document).ready(function() {
wordflick();
});