On Wednesday, January 29, 2014 12:07:20 PM UTC-5, Michael Zazzali wrote: > I created a clojurescript library for canvas drawing. It's not complete, but > I would like to get some input to see what I am doing wrong or right. > > It also might help some people as an example project. It uses both the > clj-webdriver and jasmine for testing. > > All comments suggestions are welcome. > > https://github.com/mzazzali/draw
Very nice! I've been playing around with Canvas myself using om & processing.js. I've taken a different approach from you - instead of implementing an idiomatic canvas library in ClojureScript, I've opted to take Om's approach instead and build an idiomatic interface on top of that. In essence, let all of the "core" stuff be handled by a third party library being supported by lots of other people and an active community (As I don't really have any better ideas or opinions about how implement all of the underlying mathematics and such that go into a full featured canvas/animation library, but I DO want to be able to write (as much as is possible) idiomatic and functional Clojure and not have to constantly drop down to third party library interop) I really, really love Processing's API - it's just... so much fun and simple to use, especially interactively in the REPL. Downside is - Processing really expects you to have one canvas "in focus" at a time - and it's not possible to easily switch from a 2d to a 3d context. My stuff is far from complete (i'm mulling over possibility getting rid of processing entirely but keeping the API which I've fallen in love with due to its simplicity, and laying it on top of Three.js which is just, well, tops) but if you get a chance check out what I've got so far: https://github.com/aamedina/processing.cljs Some examples I implemented using my library can be found here: http://aamedina.github.io/processing.cljs P.S. in case you're wondering, I used htmlize.el in emacs to generate the HTML for my Clojure file to get the pretty printing / syntax highlighted code - and then wrote a macro to interpolate the HTML generated in that file and associate it functions defined in the file for which the HTML has been generated. This is kept in a hash map at compile time, and depending on which functions the macro specifies it wants the source code for, (e.g "(runner/htmlize "bezier")" ), the macro turns the HTML for that function into a Clojure data structure by transforming it into Hiccup vectors! Haha. Since Sablono, a HTML templating library for Om accepts hiccup vectors as input for its own macro, after macroexpansion is completed all that's left is your specified functions source code rendered as React.js elements! Overkill? You bet. Fun saturday night? Indeed! -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/clojurescript.
