Skip to content

Commit

Permalink
prefer sample-between to clamping an rng
Browse files Browse the repository at this point in the history
  • Loading branch information
dgtized committed Nov 27, 2024
1 parent 1f8f101 commit 9f08d45
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/shimmers/sketches/pendulum_sway.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@
[:epsilon 1.0]])
:dx (+ (dr/random-int 1 6) (dr/random -0.01 0.01))
:dy (+ (dr/random-int 1 6) (dr/random -0.01 0.01))
:lambda1 (tm/clamp (dr/gaussian 0.005 0.0015) 0.0001 0.05)
:lambda2 (tm/clamp (dr/gaussian 0.005 0.0015) 0.0001 0.05)
:lambda1 ((dr/sample-between #(dr/gaussian 0.005 0.0015) 0.0001 0.05))
:lambda2 ((dr/sample-between #(dr/gaussian 0.005 0.0015) 0.0001 0.05))
:gamma-rate (dr/weighted {0.125 4 0.25 2 0.5 1 0.75 1 1.25 1})})

(defn scene [{:keys [scene-id params]}]
Expand Down
4 changes: 2 additions & 2 deletions src/shimmers/sketches/remaining.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@
(tm/- p line-delta))))

(defn draw-frame [{:keys [n-points] :as params}]
(q/stroke-weight (tm/clamp (dr/gaussian 0.225 0.15) 0.1 0.6))
(q/stroke 0.0 (tm/clamp (dr/gaussian 0.25 0.1) 0.1 0.6))
(q/stroke-weight ((dr/sample-between #(dr/gaussian 0.225 0.15) 0.1 0.6)))
(q/stroke 0.0 ((dr/sample-between #(dr/gaussian 0.1 0.1) 0.005 0.5)))
(q/no-fill)
(let [height (q/height)
pts (harmonic-loop (cq/rel-vec 0.5 0.5) (* 0.45 height) params)
Expand Down
2 changes: 1 addition & 1 deletion src/shimmers/sketches/window_glimpses.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@
:windows
(map (fn [s]
(-> s
(vary-width (tm/clamp (dr/gaussian 1.5 1.0) 0.75 2.5))
(vary-width ((dr/sample-between #(dr/gaussian 1.5 1.0) 0.75 2.5)))
(vary-meta assoc :project
(when (dr/chance (* (if (instance? Circle2 s) 0.5 1.0) 0.2))
(tm/* shadow-dir 1.8)))))
Expand Down

0 comments on commit 9f08d45

Please sign in to comment.