Liking cljdoc? Tell your friends :D

monet Build Status Dependencies Status Downloads Clojars Project

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

Including in your project

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>

Usage

(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)))))

Documentation

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

License

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 Granger
Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close