 (def l (log/get-logger "3d"))
 (strokes/bootstrap)
 
+
+(defn events->chan
+  "Given a target DOM element and event type return a channel of
+  observed events. Can supply the channel to receive events as third
+  optional argument."
+  ([el event-type] (events->chan el event-type (chan)))
+  ([el event-type c]
+   (events/listen el event-type
+                  (fn [e] (put! c e)))
+   c))
+
 (defn ^:private v [x y z]
   (js/THREE.Vector3. x y z))
 
+(defn ^:pivate animate [renderer camera scene t]
+  (.clear renderer)
+  (. camera (lookAt (.-position scene)))
+  (. renderer (render scene camera))
+  (. js/window (requestAnimationFrame (partial animate renderer camera scene) (.-domElement renderer))))
 
 ;; ref: http://bl.ocks.org/phil-pedruco/9852362
 (defcomponent plot-view
   [app owner]
   (init-state
    [_]
-   (let [w 960 h 500
+   (let [w 950 h 500
          line-geo (js/THREE.Geometry.)
          line-material (js/THREE.LineBasicMaterial.  (clj->js  {:color 0x000000
                                                                 :lineWidth 2}))]

                 (.log js/console camera)
                 (. camera (lookAt (.-position scene)))
                 (. renderer (render scene camera))
                 (.log js/console renderer)
                 (.log js/console (.-info renderer))
                 )))
           ))))
  (render-state

(ns client.views.viz.plot
  (:require-macros [cljs.core.async.macros :refer [go go-loop]]
                   [cljs.core.match.macros :refer [match]])
  (:import [goog.events EventType])
  (:require [strokes :refer (d3)]
            [dommy.utils :as utils]
            [dommy.core :as dommy]
            [goog.events :as events]
            [om-tools.core :refer-macros [defcomponent]]
            [cljs.core.match :as m]
            [client.request :refer (r)]
            [cljs.core.async :as async :refer [<! put! chan sub sliding-buffer alts!]]
            [cljs-log.core :as log]
            [om.dom :as dom :include-macros true]
            [om.core :as om :include-macros true]
