blob: 651e315cb5427ace7127326efd26c200cecdda56 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
function Timeline (tweens) {
this.tweens = tweens
this.index = 0
}
Timeline.prototype.advance = function(){
var tl = this.tweens[this.index % this.tweens.length]
if (tl.index == -1) {
tl.reset()
tl.index = 0
requestAnimationFrame(this.advance.bind(this))
}
else if (tl.index < tl.timeline.length){
tl.timeline[ tl.index ](this.advance.bind(this))
tl.index += 1
}
else {
this.index += 1
tl.index = -1
requestAnimationFrame(this.advance.bind(this))
}
}
|