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. Note that we do not create a copy of the obj from the callback, as this appears to be an uneccesary step.


#encoding: utf-8
load_library :hype
include_package 'hype'
java_import 'hype.extended.behavior.HOrbiter3D'
java_import 'hype.extended.behavior.HOscillator'
java_import 'hype.extended.colorist.HColorPool'

PALETTE = %w(#FFFFFF #F7F7F7 #ECECEC #CCCCCC #999999 #666666 #4D4D4D #333333 #FF3300 #FF6600).freeze
attr_reader :pool

def settings
  size(640, 640, P3D)

def setup
  sketch_title 'Sprite'
  @pool =
      .on_create do |obj|
    i = pool.current_index
    orb = / 2, height / 2, 0)
                    .yAngle((i + 1) *2)
                    .zAngle((i + 1) *3)
               .range(0.1, 1.0)
               .range(-180, 180)

def draw
  sketch_title(format('HSprite %d fps', frame_rate))