Skip to content

Commit

Permalink
start showing debug info for cilia-phase plot cilia function
Browse files Browse the repository at this point in the history
  • Loading branch information
dgtized committed Nov 6, 2024
1 parent 996c122 commit 975b73d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/shimmers/sketches/cilia_phase.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
rx' (dr/weighted {1.0 1.0 0.5 1.0 2.0 1.0})
amp (dr/weighted {0.1 1.0 0.2 1.0 0.3 1.0 0.4 1.0})
cx (dr/random)]
(fn [cx' x] (math/sin (* eq/TAU (+ (* rx x) cx (* amp (math/cos (* eq/TAU (+ (* rx' x) cx'))))))))))
{:params {:rx rx :rx' rx' :amp amp :cx cx}
:fn
(fn [cx' x] (math/sin (* eq/TAU (+ (* rx x) cx (* amp (math/cos (* eq/TAU (+ (* rx' x) cx'))))))))}))

(defn screen-space [y amp fx x phase]
(rv x (+ y (* amp (fx (+ x phase))))))
Expand Down Expand Up @@ -86,14 +88,17 @@
(+ 0.025 (eq/gaussian amp 0.5 -0.125 y)))
:phase (dr/gaussian 0.0 0.01)}))))

(defonce defo (debug/state))

(defn shapes [{:keys [params]}]
(let [fx (spline-fx)
spx (spline-fx)
cspx (cilia-spline-fx)
theta-x (spline-fx)
cilia-spline
(dr/weighted {cilia-line 1.0
(partial cilia-line-plot cspx) 2.5})]
(partial cilia-line-plot (:fn cspx)) 2.5})]
(reset! defo {:cspx (:params cspx)})
(mapcat (fn [{:keys [ry amp c-amp phase]}]
(let [screen (partial screen-space ry amp)
spline-pts (base-spline screen fx phase)
Expand All @@ -115,7 +120,9 @@

(defn explanation [{:keys [params]}]
(ctrl/details "Debug"
[:div (debug/pre-edn params)]))
[:div (debug/pre-edn
(merge {:params params} @defo)
{:width 120})]))

(defn page [sketch-args]
(let [params (parameters)]
Expand Down

0 comments on commit 975b73d

Please sign in to comment.