*Which may help to explain the occasionally eccentric terms of its documentation.
â€œQuil looked up in shock to see Bigelow floating high in the clouds, his balloons rustling merrily in the wind. He gruffed to her from above, â€œThis truly is a party!â€. Image after image, vista after vista, passed furry Bigeâ€™s wide-open eyes. A deep underlying beauty unfolded before him. A flock of bezier gulls whistled past. Beneath his dangling paws a distant shepherd called his scribbly sheep in for re-drawing. Goading him from the distance, wooden letters of so many different fonts mocked PERLIN-WOULD from the hilltops.
â€œThis truly was an amazing place. Here, dreams and reality had been drawn together â€“ all in one Process. â€œ_Why would I ever leave?â€ he barked with joy! _Why indeed!
(mix Processing Clojure)
â€œIn one hand Quil holds Processing, a carefully crafted API for making drawing and animation extremely easy to get your biscuit-loving chops around. In the other she clutches Clojure, an interlocking suite of exquisite language abstractions forged by an army of hammocks and delicately wrapped in flowing silky parens of un-braided joy.
â€œIn one swift, skilled motion, Quil throws them both high into the air. In a dusty cloud of pixels, they bond instantly and fly off into the distance painting their way with immutable trails of brilliant colour. Moments later, you see them swiftly return and hover nearby. Your very own ride to Perlinwould awaits. Summon the winds and ride well, my friend.
â€œLeiningen users simply need to add Quil as a dependency to their project.clj:
â€œThen to pull in all of Quilâ€™s silky goodness, (((indeed))) just add the following to your ns declaration:
â€œFor more detailed instructions head over to the wiki.
â€œPlease Note: In order to use the OpenGL features, you need to be using Leiningen 2.x.
â€œUsing Quil is as easy as eating chocolate digestives. You just need to grok three basic concepts:
â€¢ The Setup fn
â€¢ The Draw fn
â€¢ The Sketch
â€œIf setup and draw are hard working artistic gladiators, sketch is the arena in which they battle for the glory of art. (((Yeah man.))) However, they donâ€™t actually fight each other â€“ they work as a team â€“ relentlessly spilling colour all over the arena sands. The crowds roar for messy fight.
â€œsetup lays all the groundwork and is called only once at the start. draw, on the other hand, is called immediately after setup has completed, and then repeatedly until you summon it to stop. When you create an sketch and name your setup and draw fns, the fun automatically starts.
â€œA simple example is called for:
(defn setup 
(smooth) ;;Turn on anti-aliasing
(frame-rate 1) ;;Set framerate to 1 FPS
(background 200)) ;;Set the background colour to
;; a nice shade of grey.
(defn draw 
(stroke (random 255)) ;;Set the stroke colour to a random grey
(stroke-weight (random 10)) ;;Set the stroke thickness randomly
(fill (random 255)) ;;Set the fill colour to a random grey
(let [diam (random 100) ;;Set the diameter to a value between 0 and 100
x (random (width)) ;;Set the x coord randomly within the sketch
y (random (height))] ;;Set the y coord randomly within the sketch
(ellipse x y diam diam))) ;;Draw a circle at x y with the correct diameter
(defsketch example ;;Define a new sketch named example
:title â€œOh so many grey circlesâ€ ;;Set the title of the sketch
:setup setup ;;Specify the setup fn
:draw draw ;;Specify the draw fn
:size [323 200]) ;;You struggle to beat the golden ratio
â€œFeast your eyes on this beauty. (((Donâ€™t mind if I do, thank you.)))
â€œYouâ€™re witnessing setup, draw and sketch working in complete harmony. See how setup turns on anti-aliasing, sets the framerate to 1 FPS and sets the background colour to a nice shade of grey. draw then kicks into action. It chooses random stroke, fill colours as well as a random stroke weight (thickness of the pen). It then chooses some random coordinates and circle size and draws an ellipse. An ellipse with the same height and width is a circle. Finally defsketch a convenience macro around sketch ties everything together, specifies a title and size and starts things running. Donâ€™t just watch it though, start modifying it to see immediate effects. Go to town.
â€œWhen getting started with Quil, itâ€™s always useful to have the Cheatsheet handyâ€¦.â€
Other links you may like: