View StopWatch.java
package monkstone;
public class StopWatch {
private long startTime, pausedTime;
private boolean paused = true;
public StopWatch() {
startTime = System.nanoTime();
}
View ruby_wordcram.rb
# frozen_string_literal: false
if RUBY_PLATFORM == 'java'
require 'WordCram.jar'
require 'jsoup-1.7.2.jar'
require 'cue.language.jar'
wc = %w(WordAngler WordColorer WordCram WordFonter WordPlacer WordSkipReason)
sh = %w(Colorers ImageShaper Word ShapeBasedPlacer)
WC = wc.concat(sh).freeze
WC.each do |klass|
java_import "wordcram.#{klass}"
View MathToolModule.java
/**
* The purpose of this tool is to allow JRubyArt users to use an alternative
* to processing.org map, lerp and norm methods in their sketches and to implement
* JRubyArt convenenience method grid(width, height, stepW, stepH) { |x, y| do stuff }
* Copyright (c) 2015-17 Martin Prout. This tool is free software; you can
* redistribute it and/or modify it under the terms of the GNU Lesser General
* Public License as published by the Free Software Foundation; either version
* 2.1 of the License, or (at your option) any later version.
*
* Obtain a copy of the license at http://www.gnu.org/licenses/lgpl-2.1.html
View helper_methods.rb
# frozen_string_literal: false
# processing module wrapper
require_relative '../rpextras'
module Processing
# Provides some convenience methods
module HelperMethods
# processings epsilon may not be defined yet
EPSILON ||= 9.999999747378752e-05
# Nice block method to draw to a buffer.
View Boundary.pde
class Boundary {
private float lower;
private float upper;
Boundary(float lower, float upper) {
this.lower = lower;
this.upper = upper;
}
float lower() {
View simpler_sketch.rb
GRID_SIZE = 5.0
def settings
size 400, 400
end
def setup
sketch_title 'Static Sketch'
stroke 206
# grid is a convenience method of creating grid in JRubyArt
View bare.rb
# frozen_string_literal: false
require 'jruby_art'
module Processing
class Sketch < App # App is a subclass of processing.core.PApplet
# begin bare sketch ###########################################
# load_library :my_library # jruby_art method
# include_package 'org.package' # JRuby method
def settings
size 200, 200 # since processing-3.0 size 'mode' go here
View circles.rb
# Circles by Bárbara Almeida
# A fork of Circle through 3 points by Bárbara Almeida.
# Draw circles from 3 points moving on smooth random trajectories.
# https://www.openprocessing.org/sketch/211167
# JRubyArt version by Martin Prout
load_library :circles
attr_reader :points
View convert.rb
# frozen_string_literal: true
# the scanner class
class Scanner
attr_reader :sketches, :rest, :sketch
def initialize(path)
@sketches = FindSketches.new(path).sketches
end
def read_file(file_name)
View toxiclibs.rb
if RUBY_PLATFORM == 'java'
require 'toxiclibs.jar'
def import_class_list(list, string)
list.each { |klass| java_import format(string, klass) }
end
module Simulation
include_package 'toxi.sim.automata'
include_package 'toxi.sim.dla'