Skip to content
View extract.java
/**
* 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:
# http://learningthreejs.com/blog/2013/09/16/how-to-make-the-earth-in-webgl/
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
View HCallback.java
package hype;
@FunctionalInterface
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'
end
attr_reader :pool, :pool_swarm, :field, :swarm
View MagneticField.java
/**
* 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
%s
end
View euler_ball.rb
# encoding: UTF-8
# module encapsulating run
module Runner
def run
move
render
bounds_collision
end
end
View jruby_art.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View color_watch.rb
web = %w{#841B2D #c0c0c0 #ffd700}
names = %i{RUBY SILVER GOLD}
colours = names.zip(web).to_h
background color(colours[:GOLD])
View visualizer.rb
# Visualizer
# After http://dry.ly/ruby-music-visualizer by David Guttman
# Load minim and import the packages we'll be using
load_library :minim
import 'ddf.minim'
import 'ddf.minim.analysis'
attr_reader :beat, :current_ffts, :dim, :fft, :freqs, :input
attr_reader :fft_smoothing, :max_ffts, :minim, :scaled_ffts
Something went wrong with that request. Please try again.