diff --git a/src/shimmers/sketches/designed_imperfections.cljs b/src/shimmers/sketches/designed_imperfections.cljs index f3118169..f081a107 100644 --- a/src/shimmers/sketches/designed_imperfections.cljs +++ b/src/shimmers/sketches/designed_imperfections.cljs @@ -10,24 +10,27 @@ [shimmers.sketch :as sketch :include-macros true] [thi.ng.geom.circle :as gc] [thi.ng.geom.core :as g] + [thi.ng.geom.rect :as rect] [thi.ng.geom.vector :as gv] [thi.ng.math.core :as tm])) -(def width 800) +(def width 900) (def height 600) (defn rv [x y] (gv/vec2 (* width x) (* height y))) (defn shapes [] (let [seed (dr/noise-seed)] - (for [box (g/subdivide (csvg/screen width height) - {:cols (/ width 6) :rows (/ height 6)})] - (let [pos (g/centroid box) - n (dr/noise-at-point seed 0.011 pos) - damp (/ 1.0 (Math/pow 1.006 (g/dist pos (rv 0.5 0.5))))] - (gc/circle (tm/+ pos - (v/polar (* 10.0 damp) (* eq/TAU n))) - (+ 2.0 (* 0.8 damp (math/sin (* eq/TAU (- 1.0 n)))))))))) + (->> (for [box (g/subdivide (csvg/screen width height) + {:cols (/ width 6) :rows (/ height 6)})] + (let [pos (g/centroid box) + n (dr/noise-at-point seed 0.008 pos) + damp (/ 1.0 (Math/pow 1.006 (g/dist pos (rv 0.5 0.5))))] + (gc/circle (tm/+ pos + (v/polar (* 10.0 damp) (* eq/TAU n))) + (+ 2.0 (* 0.8 damp (math/sin (* eq/TAU (- 1.0 n)))))))) + (dr/map-random-sample (fn [{:keys [r]}] (/ r 200.0)) + (fn [{:keys [p r]}] (g/center (rect/rect (* 1.9 r)) p)))))) (defn scene [{:keys [scene-id]}] (csvg/svg-timed {:id scene-id