Orb

A connection to SerialOrbs via serialOrb processing program.

If not relying on network abilities, please use AmbientLight instead.

// There are virtual Orbs in this help Directory listening to NetAddr.localAddr:

(Document.current.path.dirname ++ "/VirtualOrb.rtf").load

*new(netAddr)

set(which, color, dt, action)

sets the color of orb number which in time dt.

After process is finished, action is evaluated with this as parameter.

setHSV(which, color, dt, action)

sets the color of orb number which in time dt according to HSV-space.

After process is finished, action is evaluated with this as parameter.

flash(which, startColor, flashColor, dt = 0.05, action)

flashes the Orb which with color flashColor.

After process is finished, action is evaluated with this as parameter.

//leak(which, startColor, flashColor, dt = 0.05, action)

// sets the color as fast as possible and then leaks it to original one.

/*

o = Orb(NetAddr("echnaton", 12000))

o.set([0,1,2], Color(1, 0, 1), 1)

o.set(1, Color.red(0.2), 1)

*/

// examples

o = Orb.new;

o.set(0, Color.green)

o.set(1, Color.red)

o.set([0, 1, 2], Color.hsv(0.4, 1, 1), {3.0.rand}!3)

o.set(0, Color(1, 0.5, 0.5))

o.set(2, Color.blue, 20)

o.set(0, Color.gray(0.1), 30)

o.set([0, 1, 2], Color.new255(*[1, 1, 1]*10))

o.set((0..2), Color.black)

o.set(2, Color.red, 0.5)

o.flash(1, Color.yellow(0.3), 0.05)

o.flash((0..2), Color.black, 1);

o.flash((0..2), Color.green, 1);

o.flash((0..2), Color(0.1, 0.4, 0.8), 0.1);

o.set((0..2), Color.red)

(

o.setHSV(0, Color.green, 10, {"done".postln});

o.set(1, Color.green, 10, {"done".postln});

)

o.setHSV([0, 1, 2], Color.hsv(0, 1, 1), 10)

o.set(2, Color.green, 2)

o.setHSV(0, Color.red, 10, {

"0 done".postln;

o.setHSV(1, Color.green, 10, {

"1 done".postln;

o.setHSV(2, Color.blue, 10, {

"2 done".postln;

o.flash([0,1,2], Color.white, 0.1)

})})})

// Multi Channel Expansion

o.set([0, 1, 2], Color(0, 0.4, 1), [2, 10, 2pi]);

o.set((0..2), Color(1, 0.5, 0.5), [2, 10, 2pi]);

o.set([0, 1, 2], [Color.new255(127, 255, 212), Color.new255(143, 188, 143).blend(Color.red, 0.7)], [1, 2, 3])

(

Tdef(\lichtorgel, {loop{

o.flash([0,1,2], Color.white, 0.05, action: {|this|

o.set(

[0,1,2].choose,

Color.rand(0.2, 0.9);

)

});

0.25.wait;

}})

)

Tdef(\lichtorgel).play

Tdef(\lichtorgel).stop

_____

SerialOrbs are proudly presented to you by vlispace inc.

///////// test virtual Orbs ///////

n = NetAddr.localAddr

o = Orb.new(n);

o.set(2, Color.white, 1)

o.set((0..2), Color.black, 1)

o.set((0..2), {Color.red(1.0.rand)}!3, 10)

o.set((0..2), {Color.green(1.0.rand)}!3, 1)

o.set((0..2), {Color.blue(1.0.rand)}!3, 0.1)

o.set((0..2), {Color.yellow(1.0.rand)}!3, 10)

o.set((0..2), {Color.yellow(1)}!3, 1)

o.setHSV((0..2), [Color.red, Color.green, Color.blue], 10)

o.setHSV((0..2), [Color.red, Color.green, Color.blue].scramble, 10)

o.setHSV((0..2), [Color(1,0,1), Color(0,1,1), Color(1,1, 0)].scramble, 10)

o.flash((0..2), [Color(1,0,1), Color(0,1,1), Color(1,1, 0)].scramble, 0.03)

o.flash(0, Color.green, 0.1)

o.set((0..2), {Color.blue}!3, 10)