Skip to content

Commit

Permalink
Add a beat table to help visualize beats that line up better
Browse files Browse the repository at this point in the history
  • Loading branch information
dgtized committed Aug 30, 2024
1 parent 7c7203d commit bab39e1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/shimmers/sketches.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
shimmers.sketches.ballistics
shimmers.sketches.balloon
shimmers.sketches.barcodes
shimmers.sketches.beat-table
shimmers.sketches.blobical
shimmers.sketches.bold-moves
shimmers.sketches.box-o-rama
Expand Down
27 changes: 27 additions & 0 deletions src/shimmers/sketches/beat_table.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
(ns shimmers.sketches.beat-table
(:require
[shimmers.common.ui.controls :as ctrl]
[shimmers.common.ui.svg :as usvg]
[shimmers.sketch :as sketch :include-macros true]))

(defn scene [_]
(let [divisions [1 4 6 8 12 16 24 32]]
[:table
(into [:tbody]
(for [division divisions]
(into [:tr]
(cons [:th (if (= division 1)
"beat"
(str "1/" division))]
(for [beat (range 65)
:when (some (fn [div] (= 0 (mod beat div)))
[4 6 8 12 16 24 32])]
[:td {:style {:width "1.8em" :text-align "right"}}
(if (= division 1) beat
(str (mod beat division)))])))))]))

(sketch/definition beat-table
{:created-at "2024-08-30"
:tags #{}
:type :svg}
(ctrl/mount (usvg/page sketch-args scene)))

0 comments on commit bab39e1

Please sign in to comment.