Skip to content

Commit 0219caa

Browse files
committed
Norway Clojure wip
1 parent e8eae9e commit 0219caa

1 file changed

Lines changed: 39 additions & 1 deletion

File tree

src/clojure_norway/meetup_2025_12/violin.clj

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929

3030
;; ## Relevant community projects
3131

32+
;; ![](https://clojurecivitas.github.io/images/civitas-icon.svg){width=100}
33+
34+
;; [Clojure Civitas](https://clojurecivitas.github.io/)
35+
3236
;; ![](https://scicloj.github.io/sci-cloj-logo-transparent.png){width=100}
3337

3438
;; [DSP Study group](https://scicloj.github.io/docs/community/groups/dsp-study/)
@@ -171,7 +175,7 @@ wav-format
171175

172176
(def cosine-wave
173177
(-> {:time (-> (range 0
174-
10
178+
0.1
175179
(/ 1.0 sample-rate)))}
176180
tc/dataset
177181
(tc/add-column :value #(-> %
@@ -452,6 +456,40 @@ wav-format
452456
bufimg/tensor->image)
453457

454458

459+
460+
461+
462+
463+
464+
(defn animated-echarts [{:as details
465+
:keys [specs time-for-transition]}]
466+
(kind/reagent
467+
['(fn [{:keys [specs
468+
time-for-transition]}]
469+
(let [*i (reagent.core/atom 0)]
470+
(fn []
471+
^{:key @*i}
472+
[:div
473+
[:p (pr-str (rem @*i (count specs)))]
474+
[:div {:style {:height "400px"}
475+
:ref (fn [el]
476+
(when el
477+
(let [chart (.init js/echarts el)]
478+
(.setOption chart
479+
(clj->js
480+
(specs (rem @*i (count specs))))))))}]
481+
(js/setInterval #(swap! *i inc) time-for-transition)
482+
;; Include this to force component update:
483+
[:p {:style {:display :none}}
484+
(hash @*i)]
485+
])))
486+
details]
487+
{:html/deps [:echarts]}))
488+
489+
490+
491+
492+
455493
;; ## Playing the STFT
456494

457495
(-> stft

0 commit comments

Comments
 (0)