Here is an example sketch by Joshua Davis, from the hype framework that has been changed to make use of ruby syntax. The declared aim of the hype library is to provide:- A collection of classes that performs the heavy lifting so that you can create sketches with the minimum amount of code. When using the hype library to create JRubyArt sketches it is suggested that you not simply ape the hype framework examples, but tailor your sketches to take advantage of the ruby language to create even more elegant code (Code as Art), not that it is relevant here.

Unzip the library in the processing libraries folder, rename the folder hype, rename distribution folder to library, rename the HYPE.jar to hype.jar. Check that you can see the library from the processing-3.2.1 ide. Note that we can use snake case in place of camel case, for constants use :: and not . to call. The important thing to learn from this sketch is how to implement the HCallback interface. This can be implemented as a closure (block), note we do not/should not try and use the vanilla processing method.

In this case we use the web_to_color_array convenience method (since JRubyArt-1.0.7) to convert the web string array to color int in the HColorPool constructor.

h_rotate.rb

# encoding: utf-8
load_library :hype
include_package 'hype'
java_import 'hype.extended.behavior.HRotate'
attr_reader :box_x, :box_y, :box_z, :colors
PALETTE = %w(#242424 #FF3300 #00CC00).freeze

def settings
  size(640, 640, P3D)
end

def setup
  sketch_title 'HRotate'
  H.init(self)
  @colors = web_to_color_array(PALETTE)
  H.background(colors[0])
  H.use3D(true)
  # rotate on the x axis
  H.add(@box_x = HBox.new).size(75).no_stroke.fill(colors[1]).loc((width / 2) - 175, height / 2)
  HRotate.new.target(box_x).speed_x(1).speed_y(0).speed_z(0)
  # rotate on the y axis
  H.add(@box_y = HBox.new).size(75).no_stroke.fill(colors[1]).loc(width / 2, height / 2)
  HRotate.new.target(box_y).speed_x(0).speed_y(1).speed_z(0)
  # rotate on the z axis
  H.add(@box_z = HBox.new).size(75).no_stroke.fill(colors[1]).loc((width / 2) + 175, height / 2)
  HRotate.new.target(box_z).speed_x(0).speed_y(0).speed_z(1)
end

def draw
  lights
  H.draw_stage
  # visualize axis rotation rods
  no_fill
  stroke(colors[2])
  line((width / 2) - (175 + 75), height / 2, 0, (width / 2) - (175 - 75), height / 2, 0) # x axis
  line(width / 2, (height / 2) - 75, 0, width / 2, (height / 2) + 75, 0) # y axis
  line((width / 2) + 175, height / 2, -100 ,(width / 2) + 175, height / 2, + 100) # z axis
end