monet is a small ClojureScript library to make it easier (and performant) to work with canvas and visuals.
There is a version hosted at Clojars. For leiningen include a dependency:
[rm-hull/monet "0.3.0"]
For maven-based projects, add the following to your pom.xml
:
<dependency>
<groupId>rm-hull</groupId>
<artifactId>monet</artifactId>
<version>0.2.2</version>
</dependency>
(ns game.core
(:require [monet.canvas :as canvas])
(def canvas-dom (.getElementById js/document "canvas"))
(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 "#191d21")
(canvas/fill-rect val)))))
See the API Documentation.
For more info on what the functions do look at the camel case versions in JS docs (for example the mozilla developer network).
Some futher usage details can be found in doc/GUIDE.md
Copyright (C) 2011-14 Chris Granger, Richard Hull & others.
Distributed under the Eclipse Public License, the same as Clojure.
Can you improve this documentation? These fine people already did:
Richard Hull, Joaquin, Joakin, Bitdeli Chef, Osbert Feng & Chris GrangerEdit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close