Skip to content

Commit

Permalink
attach noise seed to each circle at creation
Browse files Browse the repository at this point in the history
  • Loading branch information
dgtized committed Jul 15, 2024
1 parent 822bfa4 commit 12bf632
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/shimmers/sketches/ring_impressions.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@
(* 0.4 (g/area bounds))))
candidate))
(repeatedly 200
(fn [] (let [circles (candidate-circles bounds)]
{:circles circles
:lines (connectives circles)})))))
(fn []
(let [circles (map (fn [c] (vary-meta c assoc :noise (dr/noise-seed)))
(candidate-circles bounds))]
{:circles circles
:lines (connectives circles)})))))

;; TODO use exit-bands to calculate range bands for each ring. Should help with
;; not showing the obviously starting line at the zero angle
Expand Down Expand Up @@ -93,8 +95,9 @@
(map (fn [segment] (g/translate segment p))
(lines/split-segments split-chance points)))))))

(defn tree-rings [noise {p :p radius :r} exits]
(let [bands (exit-bands p exits)]
(defn tree-rings [{p :p radius :r :as c} exits]
(let [bands (exit-bands p exits)
noise (noise-pos (:noise (meta c)))]
(mapcat (fn [r]
(ring noise
p
Expand Down Expand Up @@ -122,8 +125,7 @@
;; TODO: fix the center point so it's displaced correctly
(concat (mapcat second lines)
(mapcat (fn [circle]
(tree-rings (noise-pos (dr/noise-seed)) circle
(exits circle (map first lines))))
(tree-rings circle (exits circle (map first lines))))
circles))))

(defn scene [{:keys [scene-id]}]
Expand Down

0 comments on commit 12bf632

Please sign in to comment.