monet is a small ClojureScript library to make it easier (and performant) to work with canvas and visuals.

(require '[monet.canvas :as canvas])

The usual workflow is calling init and getting the monet-canvas that returns, and then start adding entities with add-entity. An entity can be created with the entity function.

(def monet-canvas (canvas/init canvas-dom "2d"))

(canvas/add-entity monet-canvas :background
                   (canvas/entity {:x 0 :y 0 :w 600 :h 600} ; val
                                  nil                       ; update function
                                  (fn [ctx val]             ; draw function
                                    (-> ctx
                                        (canvas/fill-style "green")
                                        (canvas/fill-rect val)))))