Skip to content

beders/rough-cljs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rough-CLJS

A data-driven, reagent-wrapper for RoughJS

This library provides a simple reagent component for RoughJS which is a fun library to create diagrams that look hand-drawn.

See examples below.

Installation

Clojars Project

Get it from Clojars: [monoid/rough-cljs "1.0"]

If you are using Shadow-CLJS, it will download the JavaScript dependency automatically.

Otherwise, add RoughJS via NPM: $ npm install -D roughjs

You will also need reagent 0.10.0 in your project.

Usage

To use it, require it and add it to your hiccup:

(require '[rough-cljs.core :refer [Rough]])

(defn MyComponent []
  [:div [Rough {:svg {:width 200 :height 200}} [[:rectangle [10 10 100 100] {:fill "blue"}]]]

Note: Only changes to the drawing primitives have any effect when re-drawing this component.

All supported primitives like rectangle, circle etc. have been defined via spec. (see rough-cljs/spec)

Check the docstring of Rough for more information.

Examples

This way please!

Build

Use shadow-cljs: $ shadow-cljs watch app

Kudos

You guys rock:

About

A data-driven, reagent wrapper for RoughJS

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published