     previousTimestamp = null
     animatorId = null
 
-    advanceAnimation = ->
-      animatorId = requestAnimationFrame animate
-
-    cancelAnimation = ->
-      cancelAnimationFrame animatorId
-
-    animate = (timestamp) ->
+    advanceAnimation = -> animatorId = requestAnimationFrame animate
+    cancelAnimation = -> cancelAnimationFrame animatorId
+
+    animate = (timestamp) =>
       previousTimestamp ?= timestamp
-
-      if timestamp == previousTimestamp
-        return advanceAnimation()
+      return advanceAnimation() if timestamp == previousTimestamp
 
       # The elapsed time is typically about 16ms.
       elapsed = timestamp - previousTimestamp

    return if @lastEvent?.repeat

    activationTime = ++@time

    isMyKeyStillDown = =>
      @time == activationTime and @keyIsDown

    # Store amount's sign and make amount positive; the logic is clearer when amount is positive.
    sign = Math.sign amount

      previousTimestamp = timestamp

      # The constants in the duration calculation, above, are chosen to provide reasonable scroll speeds for
      # distinct keypresses.  For continuous scrolls, some scrolls are too slow, and others too fast. Here, we
      # speed up the slower scrolls, and slow down the faster scrolls.
      if isMyKeyStillDown() and 50 <= totalElapsed and @minCalibration <= calibration <= @maxCalibration
        calibration *= 1.05 if 1.05 * calibration * amount <= @calibrationBoundary # Speed up slow scrolls.
        calibration *= 0.95 if @calibrationBoundary <= 0.95 * calibration * amount # Slow down fast scrolls.

      # Calculate the initial delta, rounding up to ensure progress.  Then, adjust delta to account for the
      # current scroll state.
