 
 (defn progress-texture
   "Draws an empty box that can serve as a default progress bar for preloading images"
-  [fraction {:keys [empty-colour full-colour
-                    border-colour border-width draw-border
-                    width height
-                    highlight highlight-offset highlight-width
-                    lowlight lowlight-offset lowlight-width]
-             :or {empty-colour 0x000000
-                  full-colour 0x808080
-                  border-colour 0xffffff
-                  border-width 2
-                  draw-border false
-                  width 600
-                  height 40
-                  highlight-offset 0
-                  highlight-width 1
-                  lowlight-offset 0
-                  lowlight-width 1
-                  }
-             :as options}]
+  [renderer fraction {:keys [empty-colour full-colour
+                             border-colour border-width draw-border
+                             width height
+                             highlight highlight-offset highlight-width
+                             lowlight lowlight-offset lowlight-width]
+                      :or {empty-colour 0x000000
+                           full-colour 0x808080
+                           border-colour 0xffffff
+                           border-width 2
+                           draw-border false
+                           width 600
+                           height 40
+                           highlight-offset 0
+                           highlight-width 1
+                           lowlight-offset 0
+                           lowlight-width 1
+                           }
+                      :as options}]
   (let [box (js/PIXI.Graphics.)]
     (doto box
       (.beginFill empty-colour)

      (let [coll (<! (resources/load-urls urls
                      (fn [i num-urls url obj]
                        (set! (.-texture b)
                              (progress-texture (/ i num-urls) options)))))]

        ;; fadeout
        (<! (fadeout b :duration fade-out))

        (set! (.-alpha spr) (+ start (* (- end start) (/ (- ticks i) ticks))))
        (when (pos? i) (recur (dec i)))))))

(defn load-resources [{:keys [renderer] :as canvas} layer urls & {:keys [fade-in fade-out]
                                              :or {fade-in 0.01 fade-out 0.01}
                                                                  :as options}]
  (let [b (add-prog-bar renderer (m/get-layer canvas layer) options)]
    (go
      ;; fade in
      (<! (fadein b :duration fade-in))
