 
   (update
    [this event]
-    (if (= :time/tick (:type event))
+    (case [(:type event) (:button event)]
+      [:time/tick nil]
       (assoc this 
         :accum-time
         (+ (:accum-time this) (:elapsed event))
         :colors
         (generate-color (:accum-time this) alpha deg-per-ms))
-      this)
-    )
+
+      [:button/repeat :x-axis]
+      (let [delta (* (or (:value event) 0)
+                     (or (:elapsed event) 0)
+                     adjustment-rate)
+            new-rate (-> deg-per-ms (+ delta) (min max-rate) (max min-rate))]
+        (assoc this :deg-per-ms new-rate))
+      this))
 
   (render
    [this pixel]

        h (mod (* t deg-per-ms) 360)]
    (color/hsv* h 1.0 v)))

(defrecord PulseMode
  [colors alpha deg-per-ms accum-time]


(defn pulse
  [color]
  "Creates a pulse mode starting at the given color/hsv"
  (PulseMode. color 1.0 (/ 6.0 100000.0) 0))
