I am phd student at Saratov State University and I am taking part in the GSOC 2014. My project is to add support for ClojureScript to Quil library.
What is Quil?
Quil is a Clojure wrapper for Processing Java library. It is used for creating animations. You can see a lot of examples here:
http://processing.org/examples
Nikita Beloglazov wrote a very good intro to Quil, check it if you don't have experience with Quil: http://nbeloglazov.com/2014/05/29/quil-intro.html
Nikita Beloglazov wrote a very good intro to Quil, check it if you don't have experience with Quil: http://nbeloglazov.com/2014/05/29/quil-intro.html
Currently Quil supports only desktop environment for running sketches. But Processing supported not only desktops. It works well inside the browsers (how you can see in previous examples).
- Write sketch fully in JavaScript;
- Write sketch in Processing Language and exporting it to pde format.
I chose for Quil on ClojureScript the first approach. This makes sence if we want to save maximal compatibility between desktop and browser sketches in Quil.
So, look at the following code:
With this code, we get here is a simple sketch (click on it to start/stop):
One more important thing about Quil on ClojureScript: You can control sketch from you html page. Look at this function:
They called when you push the button. Instead of stopping the sketch tthere might be a code which changes sketch state or draw something.
So, if you want to play with previous example you can clone it from github and run with command
lein run
on your desktop. Or you can call
lein compile
and open
web/index.html
for running it in your browser.
If you are interested, you can get started by checking the following resources:
- https://github.com/Norgat/quil/tree/cljs - my working branch;
- https://github.com/Norgat/quil-cljs-examples - a lot of examples for Quil on ClojureScript
- Short docs about available macroses and functions.
Or you can create new project for sсratch with command lein new quil-cljs project-name
What about plans?
I'm going to do the following things before ClojureScript support is added to the main Quil repository:
- Add support for :advanced optimization level of Google Closure;
- Write more complete tests for ClojureScript part of Quil;
- Investigate a few strange behaviors in ClojureScript (like value of mousePressed inside mouseMoved event).
P.S. Quil middleware and fun-mode features are not be supported in this alpha but they will be supported in 2.0.1-SNAPSHOT.