Skip to content

Commit

Permalink
replace some circles with squares and adjust noise rate
Browse files Browse the repository at this point in the history
  • Loading branch information
dgtized committed Jul 30, 2024
1 parent 5d02dbb commit ee7ad51
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/shimmers/sketches/designed_imperfections.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ee7ad51

Please sign in to comment.