A ClojureScript visual library
Clojure
Switch branches/tags
Clone or download
Pull request Compare This branch is 75 commits ahead, 2 commits behind ibdknox:master.
Latest commit bcf31e0 Jan 6, 2017
Permalink
Failed to load latest commit information.
doc
src/monet
test/monet
.gitignore
.travis.yml
CHANGELOG.md
README.md
project.clj

README.md

monet

Build Status Dependencies Status Downloads Clojars Project Maintenance

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.