Getting Started on MacOS
Getting Started With JRubyArt
If you love to code because it is a creative process, then you should give JRubyArt a try because it can be used to create music, art, animations, videos and much more. Also since it is based on the latest Processing you can access a vast range of libraries to make the difficult things easier.
Why JRubyArt?
Since Processing already comes wrapped in an easy-to-use package, you may ask: “why should I bother with JRubyArt?”
The answer: if you know how to write Ruby, you can use Processing as a visual presentation layer of a much more complex program. Games, interactive art exhibits, innovative music projects, anything you can imagine; it’s all at your fingertips.
Additionally, you don’t have to declare types, voids, or understand the differences between floats and ints to get started, as you do in pure Processing.
Although there are some drawbacks to using the Ruby version Processing (slower start up time, and sometimes performance), having Ruby’s API available to translate your ideas into sketches more than makes up for them.
Java
Most OpenJDK builds 17+ seem to be ok now including ibm and graal versions if you have any difficulties then try Eclipse Temurin.
brew install wget # yes!!! you do need wget, curl won't work
brew cask install adoptopenjdk # or openJ9 which may require manual install
JRuby
It is possible to get away without doing system install of JRuby (using jruby-complete
instead) but the default configuration assumes a JRuby install. There is homebrew script for this too.
brew install jruby # installs latest JRubyArt
You don’t need rvm
or rbenv
for JRubyArt since we call jruby
directly when needed, in fact you may find a combination of MRI for regular ruby
commands and jruby
only when needed (called internally to run a sketch) works for you. MRI gem command installs jruby_art far quicker than jgem
, but jgem
install is a lot safer.
JRubyArt
gem install jruby_art
Install other gems as required
jgem install toxiclibs # optional
jgem install pbox2d # optional
jgem install geomerative # optional
jgem install wordcram # optional
If you wish install vanilla processing, but it is not required since JRubyArt-2.0.
If you haven’t installed JRubyArt before you should:-
k9 --install # no arguments
To configure JRubyArt, install samples, and also install jruby-complete
If you have installed JRubyArt before you should:-
k9 -fi config # -f or --force flags force removal of previous configuration
Use:-
k9 --help # or -h to show command line options
# or
k9 --check # or -? to check configuration
Running examples
To explore the installed examples:-
cd ~/k9_samples
rake # to run examples randomly as a demo
# or check available tasks with
rake --tasks
# use a task to randomly run a group of sketches eg
rake shaders # runs the shader examples
Create your own sketches
To create a simple sketch:-
k9 -c fred 200 200 # sketch name=Fred width=200 height=200 mode=default
k9 -c my_sketch 300 300 p2d # sketch name=MySketch width=300 height=300 mode=P2D
Edit fred.rb
or my_sketch.rb
with your favourite editor preferably vim
, emacs
or atom
.
To run sketch using the command line
k9 -r fred.rb
To run a sketch from editor see editors
Read more about using the processing api here
Read more about using the processing api here