               (doto basket-head
                 (. (emptyBehaviorList))
                 (.setRotation 0)
-                (animate [:move [:from {:up 30}]]
-                         (fn [t] (on-finish))))
-              (animate basket-body [:scale [:from scale-factor :to 1 :time 120]]) 
+                (animate! [:move :to [0 0]] (fn [t] (on-finish))))
+              (animate! basket-body [:scale :to 1 :time 120]) 
               (set! this.isOpened false))))
     ;; make sure the sprite changes when the mouse hovers over the basket
     (listen basket-body :mouse-enter (fn [mouseEvent] (. basket-container (doOpen))))

  CAAT.Behavior
  (behavior [s] s)
  cljs.core.Vector
  (behavior [v]
                (let [[kind & args] v] 
                  (apply (kind kw->behavior-fn) args))))

(defn animation-specs->behavior
  "Given a TARGET and any number of animation SPECS, create & return a

                      last-caat-behavior)))))
       container)))

(def kw->behavior-fn2
     {:move move-behavior
      :rotate rotate-behavior
      :scale scale-behavior
      :alpha alpha-behavior})

(defn- behavior-spec->behavior
  "Given a behavior spec like [:move ...], transform that into an actual CAAT.Behavior."
  [spec target]
  (let [[kind & args] spec]
    (apply (kw->behavior-fn2 kind) :target target args)))


(defn create-animation
  "Create an animation. This will return a function which can be
applied to a target to animate it."
  ([] (fn [target & {:keys [on-finish]}]
        (when (fn? on-finish)
         (on-finish target))))
  ([spec]
     (if (fn? spec)
       (fn [target & {:keys [on-finish] :or {on-finish nil}}]
         (spec target)
         (when (fn? on-finish)
           (on-finish target)))
       (let [director *director*]
         (fn [target & {:keys [on-finish] :or {on-finish nil}}]
           (log/info logger (str "Running animation spec: " spec "; Current (x,y):" (.x target) "," (.y target)))
           (let [bh (behavior-spec->behavior spec target)
                 dur (. bh (getDuration))]
             (when (fn? on-finish)
               (.addListener
                bh
                (clj->js
                 {:behaviorExpired
                  (fn [bh time actor]
                    (binding [*director* director]
                      (on-finish actor)))})))
             (.addBehavior target bh))))))
  ([spec1 spec2 & more]
     (fn [target & {:keys [on-finish]}]
       ((create-animation spec1)
        target
        :on-finish
        (fn [target]
          ((create-animation spec2)
           target
           :on-finish
           (fn [target] 
             ((apply create-animation more)
              target
              :on-finish
              on-finish))))))))

(defn animate!
  ([target & specs]
     ((apply create-animation specs) target)))


(defn animation
  [target & animations]
  {:pre [(actor? target)]}
