 
   (render
     [this pixel]
-    (let [angle (sphere/angle-offset (:sphere pixel) [0 polar azimuth])
-          index (* scale (- angle offset))]
+    (let [[_ angle _] (:sphere pixel)
+          index (- (* scale angle) offset)]
       (color/rainbow index))))
 
 
 (defn rainbow
   "Creates a new rainbow color-cycling mode."
   []
-  (RainbowMode. 0.0 0.0 1.0 1.0 0.0))
+  (RainbowMode. 1.0 1.0 0.0))

(ns org.playasophy.wonderdome.mode.rainbow
  (:require
    [org.playasophy.wonderdome.geometry.sphere :as sphere]
    [org.playasophy.wonderdome.mode.core :as mode]
    [org.playasophy.wonderdome.util.color :as color]))


(def ^:private ^:const move-rate
  "Rate at which the angles change in radians per millisecond."
  0.0005)


(defrecord RainbowMode
  [polar azimuth scale speed offset]

  mode/Mode


            offset' (if (> offset' 1.0) (- offset' 1.0) offset')]
        (assoc this :offset offset'))

      [:button/repeat :x-axis]
      (assoc this :scale
             (control/adjust scale event
                             :rate 0.5
                             :min-val 0.1
                             :max-val 5.0))

      [:button/repeat :y-axis]
      (assoc this :speed
             (control/adjust speed event
                             :rate 0.5
                             :min-val -3.0
                             :max-val  3.0))

      ; default
      this))
