     actor))
 
 
-(defn fade! [target director & {:keys [start-time duration]
-                                :or {start-time nil duration 2000}}]
+(defn fade! [target & {:keys [start-time duration director]
+                       :or {start-time nil duration 2000}}]
   (doto target
-    (.addBehavior (doto (CAAT/AlphaBehavior.)
-                    (.setFrameTime (or start-time (.time director)) duration)
-                    (.setValues 1 0)))))
+    (.addBehavior (alpha-behavior :from 1 :to 0 :time [(or start-time (.time (->director director))) duration]))))
 
 (let [auto-expire-listener
       (clj->js

     (.time scene)
     start-time
     (fn [scene-time timer-time timetask]
       (on-create scene-time)
       (dotimes [x batch-count]
         (let [rotation-direction (if (< (Math/random) 0.5) -1 1)
               star (doto (star :radius (rand-nth (map (comp dec dec dec) [12 14 16 18 20]))
                                    :color (rand-nth ["yellow" "chartreuse" "orange" "red" "powderblue" "magenta" "cyan"])) 
                      (.enableEvents false)
                      (.setLocation (+ (x-of start-position) (* x 10)) (+ (y-of start-position) (rand-int 30)))
                      ;; (. (cacheAsBitmap))
                      (.addBehavior
                       (rotate-behavior :from 0 :to (* rotation-direction (+ 180 (* (* (rand-int 2) -1) (rand-int 180))))
                                            :time [scene-time 3000]))
                      ;; TODO: why is the following not working? (rotation stops after some seconds)
                      ;; (animate [:rotate [:from 0 :to (+ 180 (* (* (rand-int 2) -1) (rand-int 180)))
                      ;;                    :time [scene-time 3000]]])
                      (fall! director :duration (+ 2000 (rand-int 1000)))
                      (.addBehavior (doto (CAAT/AlphaBehavior.)
                                      (.setFrameTime scene-time 500)
                                      (.setValues 0 1))
                                    )
                      (fade! director
                             :duration (+ 3000 (rand-int 1000))
                             :start-time (+ scene-time 500)))]
           (add! target star)
           ;; randomize the star z
           (.setZOrder target star (- (rand-int batch-count) (/ batch-count 2))) 
           ))
       (repeatedly-create-stars target scene
              :start-time repeat-interval
              :start-position start-position
              :batch-count batch-count
              :repeat-interval repeat-interval
              :on-create on-create)
       )
     (fn []) (fn []))))


(def kw->behavior-fn {:move (fn [arg] (apply move-behavior arg))
                      :rotate (fn [arg] (apply rotate-behavior arg))
                      :scale (fn [arg] (apply scale-behavior arg))
                      :alpha (fn [arg] (apply alpha-behavior arg))
                      :parallel parallel-behavior})

(defprotocol AAnimationSpec
