old_blueyes Posted July 21, 2018 Share Posted July 21, 2018 Hi, Is it possible to run 2 separate timelines one after another? i.e. using the onComplete parameter on the first timeline to fire a function which contains the second timeline. using something similar to this: var timeline = this.tweens.timeline({ tweens: [{ targets: targs, x: startPos, duration: startDur, ease: 'Sine.easeInOut', delay: delay }, { targets: targs, x: jostlePos, duration: lineDur, ease: 'Sine.easeInOut', yoyo: true, repeat: 2, onComplete: function () { var timeline2 = this.tweens.timeline({ tweens: [{ targets: targs, x: 1000, duration: raceDur, ease: 'Sine.easeInOut', delay: delay }] }); console.log('complete'); } }] }); All i get is Cannot read property 'timeline' of undefined, which is referring to the second timeline, as the first plays without bother Link to comment Share on other sites More sharing options...
prob Posted July 23, 2018 Share Posted July 23, 2018 Your second this.tween.timeline is out of scope; 'this' has no reference to tweens.timeline. You can define: var _this = this; ...outside of the first tween, and in the onComplete call: _this.tweens.timeline. Link to comment Share on other sites More sharing options...
Recommended Posts