Installing

Nikita Beloglazov edited this page Jul 18, 2016 · 31 revisions

So you want to live program some art, do you? Eh? Well, lucky thing that - this is just the place to get you started. First up you need a few things:

  • A Computer (a working one is best)
  • A JVM - most computers have one of these inside (you will need a JRE that has graphics components)
  • Something friendly called Leiningen installed (visit the link to find installation instructions)
  • A terminal emulator with a lovely font and pretty colours.

OK, so the first step is to create yourself a new project directory structure. You can do that with lein new quil .... For example:

/Users/sam/demo $ lein new quil my-art
Generating a project called my-art based on the 'quil' template.
To see other templates (app, lein plugin, etc), try `lein help new`.

Now cd into your new project dir:

/Users/sam/demo/ $ cd my-art

Check to see if everything is in order:

/Users/sam/demo/my-art $ ls
LICENSE  project.clj  README.md  src

Finally, fire up a REPL for coding fun:

/Users/sam/demo/my-art $ lein repl
...
nREPL server started on port 54408 on host 127.0.0.1
...

user=> (use 'my-art.core :reload-all true)

Behold, your first Quil painting...

Now close Quil window, open src/my_art/core.clj in your favorite text editor and increase rotation speed by changing line

:angle (+ (:angle state) 0.1)

to

:angle (+ (:angle state) 0.3)

Save and start sketch again:

user=> (use 'my-art.core :reload-all true)

Now circle rotates 3 times faster! For more advanced workflow where you don't need to close sketch window at all, but can update code on fly check Dynamic Workflow for REPL.