this.changeTimer.onTimerFired = timerFunction1; function timerFunction1() { if(this.counter < width) { clock.update( this.counter ); this.counter += 10; } else { //clock.updateTime(); this.onTimerFired = timerFunction2; } } function timerFunction2() { if(this.counter > -width) { clock.update( this.counter ); this.counter -= 10; } else { this.onTimerFired = timerFunction1; this.counter = -width; } }