Skip to content
package org.monkstone;
import java.nio.file.WatchEvent;
interface CodeListener {
public void code_event(WatchEvent<?> event);
View pixellator.rb
load_library :chooser
attr_reader :img, :data, :skip, :poster
# Sophisticated example of file chooser.
KEYS = %w(0 4 5 6 7 8 9)
def settings
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
* Return a full path to an item in the data folder as a File object.
* See the dataPath() method for more information.
public File dataFile(String where) {
// isAbsolute() could throw an access exception, but so will writing
// to the local disk using the sketch path, so this is safe here.
File why = new File(where);
if (why.isAbsolute()) return why;
View blue_marble.rb
# Earth model with bump mapping, specular texture and dynamic cloud layer.
# Adapted from the THREE.js tutorial to processing by Andres Colubri,
# translated to JRubyArt by Martin Prout:
attr_reader :earth, :clouds, :earth_shader, :cloud_shader, :earth_rotation
attr_reader :clouds_rotation, :target_angle
IMAGES = %w(earthmap1k.jpg earthcloudmap.jpg earthcloudmaptrans.jpg earthbump1k.jpg earthspec1k.jpg).freeze
TEXTURES = %i(earth cloud alpha bump spec).freeze
package hype;
public interface HCallback {
public void run(Object obj);
View magnetic_field.rb
load_library :hype
include_package 'hype'
module Hype
java_import 'hype.extended.layout.HGridLayout'
java_import 'hype.extended.behavior.HMagneticField'
java_import 'hype.extended.behavior.HSwarm'
attr_reader :pool, :pool_swarm, :field, :swarm
* Here is an example of a more tricky sketch to convert, first I exported to pure java (none that obfusctating processing
* crap), interestingly we can use a jdk8 lambda in place of a anonymous class for callback this is probably one way
* forward, although to be honest it may actually pay to create a JRuby extension to get more efficient operation.
import processing.core.*;
import hype.*;
import hype.extended.layout.HGridLayout;
import hype.extended.behavior.HMagneticField;
View convert.rb
# convert.rb
VECLIBR = /\:(vecmath|fastmath)/
sketch = <<CODE
require 'propane'
class %s < Propane::App
View euler_ball.rb
# encoding: UTF-8
# module encapsulating run
module Runner
def run
Something went wrong with that request. Please try again.