Any editor

From console:-

mkdir 'any_name'
cd 'any_name'
touch 'fred.rb'

Vim

Open new console

cd 'any_name'
vim fred.rb

In 1st console

k9 -w fred.rb
# A bare sketch is displayed with a default size, background etc.

Edit sketch in vim eg

background 0
# Sketch reloads on `:w` save with a black background
# PS: in processing this is a so called static sketch (ie no draw loop)
# no interaction is possible via mouse etc

Other editors eg atom

From console

atom fred.rb
# opens sketch for editing in atom

From same console

k9 -w fred.rb
# As above a bare sketch is displayed with default background

Edit sketch in atom, on save sketch will reload

Normal sketches (ie with draw loop, sketch_title etc)

Use the JRubyArt sketch creator facility to create an outline sketch as follows

k9 -c fred 200 200
# creates fred.rb, with `size 200, 200` you can do interesting
# things with code in the draw loop

Then watch, and edit as above (with editor of choice, preferably vim for console, or atom for gui, with language-jruby-art package).

Suggested exercises:-

  1. set background and fill in the draw loop, draw ellipse (or rect) in fixed location, then substitute mouse_x or mouse_y for x or y coordinates…
  2. Experiment with no background, semi transparent background, or semi transparent fill eg background(color(200, 0, 0, 50)) or fill(200, 100)