Archive for the ‘Uncategorized’ Category

Visual Metronome

/*
* metronome
*/
int stage = 600;
int mains = int(random(3,9) );
int subs = int(random(3,6) );
float moon_size = 3;
int bpm = 60;
int active_main = 0;
int active_sub = 0;
color main_color = #292B89;
color first_color = #1A1B55;
color active_color = 0×95FFFFFF;
int my_frame_rate = 12;
float bps = float(bpm) / 60 ;

void setup() {
size(stage, stage);
frameRate(my_frame_rate);
noStroke();
}
void draw() [...]

Ruby Duration

Duration.new recieves a string describing a duration of time, and converts it into: seconds, and a standard readable format.
Or, you can pass Duration.new an integer representing seconds, and receive the same standard readable format.
Usage:
Passing a String

duration = Duration.new("2weeks 8 hr 30m")
duration.seconds # => 1240200
duration.readable # => "2 weeks, 8 hours and 30 [...]

June 12, 2009 • Posted in: Uncategorized • One Comment