diff --git a/resources/public/index.html b/resources/public/index.html
index 9a74b2d..f5f239c 100644
--- a/resources/public/index.html
+++ b/resources/public/index.html
@@ -10,6 +10,7 @@
FPS:
Position:
+ Velocity:
diff --git a/src/cljs/frpong/core.cljs b/src/cljs/frpong/core.cljs
index 9ea8b28..ad50067 100644
--- a/src/cljs/frpong/core.cljs
+++ b/src/cljs/frpong/core.cljs
@@ -30,6 +30,8 @@
;; | renderer |
;; +----------+
+(defn abs [x] (.abs js/Math x))
+
(defn positioner [tick-chan vel-chan pos-chan-in pos-chan-out]
(go-loop
(let [tick ( p (- size padding)) (- (abs v))
+ :else v))
+ tick ( xn padding) (< xn (- width padding))) vel-x (- vel-x))
- vel-yn (if (and (> yn padding) (< yn (- height padding))) vel-y (- vel-y))]
+ vel-xn (adjust-v xn vel-x width)
+ vel-yn (adjust-v yn vel-y height)]
(>! vel-chan-out [vel-xn vel-yn]))))
+(defn render-loop [pos-chan vel-chan]
+ (go-loop
+ (let [[x y] (map int (! pos-chan init-pos))
- (go (>! vel-chan init-vel))
-
- (go-loop
- (let [[x y] (map int (