wordBins


(

var str = "";

Array.fill(27, {|i| ((i+97).asAscii!i ++ " ")!i}).flatten(2).do{|it|

str = str ++ it

}; 

d = str.wordBins(3)

)



// use SwingOSC for proper umlauts in visualization

(

var win, extX, extY, winRect, view, fontName, strings, numbers, countSpec, sizeSpec, alphaSpec, colorSpec, sFactor = 0.25;

#numbers, strings = (d.flop);


strings = strings.collect{|str|

var y = "\"\""; 

str.do({|char| 

y = y ++ " ++ 0x" ++ char.ascii.asHexString.copyToEnd( 6 )++".asAscii" 

});

};


countSpec = [numbers.minItem, numbers.maxItem].asSpec;

sizeSpec  = [10, 60].asSpec;

alphaSpec = [1, 0.2].asSpec;

colorSpec = [0.2, 1].asSpec;


extX = 1440;

extY = 900;

winRect = GUI.window.screenBounds;


fontName = "GillSans-Light";


win = GUI.window.new("", winRect, border: false);

win.view.keyDownAction_{|me, char|  (char == $q).or{char == 27.asAscii}.if{win.close}};

win.view.background = Color.white;


view = GUI.userView.new(win, win.view.bounds);

view.drawFunc = {

var numAppearance, val;

strings.do{|str, i|

numAppearance = numbers[i];

val = countSpec.unmap(numAppearance);


GUI.pen.font = GUI.font.new(fontName, (sizeSpec.map(val)).asInteger);

GUI.pen.color = Color.red(colorSpec.map(val), alphaSpec.map(val));

GUI.pen.stringCenteredIn(str, Rect((extX*(1-sFactor)).rand, (extY*(1-sFactor)).rand, extX*sFactor, extY*sFactor));

/*str.drawCenteredIn(

Rect((extX*0.5 -50).rand, (extY*0.5 -250).rand, 50, 250), 

Font(fontName, (sizeSpec.map(val)).asInteger),

Color.red(colorSpec.map(val), alphaSpec.map(val))

);*/

};

};

view.keyDownFunc_(win.view.keyDownAction);

win.fullScreen;

win.front;

win.view.focus

)