     return unless @running
 
     # Measure delta
-    delta = 0
-    if @lastTime
-      t = @currentTime()
-      delta = t - @lastTime
-      @lastTime = t
+    t = @currentTime()
+    delta = t - @lastTime
+    @lastTime = t
 
     # Add to elapsedTime
-    if @direction then @elapsedTime += delta else @elapsedTime -= delta
+    @elapsedTime += delta
 
     # End case
     if @isComplete()
-      @position = if @direction then 1.0 else 0.0
+      # fix value on bounds
+      @elapsedTime = @duration
       @emitPosition()
       @stop()
       return
 
     # Continue case
-    if @repeat < 1
+    if @elapsedTime < @duration
       @emitPosition()
       return
 
     # Loop case
     @elapsedTime = @elapsedTime - @duration
-
     @direction = !@direction if @autoreverse
-    @repeat -= 1
+    @repeat -= 1 if @repeat > 0
 
     @emitPosition()
 

      @repeatCount = value
    @inPorts.autoreverse.on 'data', (value) =>
      @autoreverse = value

    # tick
    @inPorts.tick.on 'data', () =>

    @running = false

  unpause: () ->
    @lastTime = @currentTime()
    @running = true

  emitPosition: () ->
    return unless @outPorts.value.isAttached()
    pos = @elapsedTime / @duration
    pos = 1.0 - pos unless @direction
    @outPorts.value.send(pos)
    @outPorts.value.disconnect()

