.cc - week seven.
I have had a play around with the following IXI SC classes: Scroll Number Box, Midi Keyboard, Grid, BoxGrid and ParaSpace. From the outset I liked the look of ParaSpace the most, so chose to explore it and come up with this little bit of code. It's based on an example provided in the ParaSpace help, but has some more UI functionality.
(
var popMenu, popItem, popMenu2, popItem2;
//synth
SynthDef( "SimpleSaw",
{arg freq, amp=0.01;
Out.ar(0, VarSaw.ar(freq, 0, amp)!2 * EnvGen.ar(Env.perc(0.01,0.4), doneAction:2));
}).load(s);
w = SCWindow("ParaSpaced", Rect(0, 60, 1342, 800)); //WINDOW
a = ParaSpace.new(w, bounds: Rect(0, 0, 1140, 798)); //A = PARASPACE
//SLIDER = DOT SIZE
y = SCSlider(w, Rect(1200, 80, 100, 40))
.focusColor_(Color.red(alpha:0.2))
.action_({
a.setNodeSize_(y.value * 1000);
});
//POP-UP MENU = DOT TYPE
popItem = ["rect", "circle"];
popMenu = SCPopUpMenu(w, Rect(1200, 40, 100, 20));
popMenu.items = popItem;
popMenu.action = { arg popMenu;
popItem.at(popMenu.value).postln;
a.setShape_(popItem.at(popMenu.value));
};
//POP-UP MENU = Background Colour
//popItem2 = ["red", "blue"];
//popMenu2 = SCPopUpMenu(w, Rect(1200, 0, 100, 20));
//popMenu2.items = popItem2;
//popMenu2.action = { arg popMenu2;
// popItem2.at(popMenu2.value).postln;
// a.setBackgrColor_(Color.popItem2.at(popMenu2.value));
// };
//popItem.at(popMenu.value)
//36 RANDOM DOTS
36.do({arg i; a.createNode(1100.rand.round(100), 700.rand.round(100)); a.setFillColor_(Color.new255(0, 0, 0))});
//CONNECTING DOTS
a.connectAction_({arg node1, node2;
Synth( "SimpleSaw", [\freq, node1.nodeloc.y]);
Synth( "SimpleSaw", [\freq, node2.nodeloc.x]);
});
t = Task({
inf.do({arg i;
6.do({arg j; a.createConnection(35.rand, 35.rand);});
176.do({arg j; a.deleteConnection(35.rand, 35.rand);});
0.6.coin(a.setNodeLoc1_(35.rand, 1.0.rand, 1.0.rand);
a.setNodeColor_(35.rand, Color.new255(255.rand, 0, 0));
);
a.deleteConnections;
0.5.rand.wait;
})
}, AppClock);
t.start;
w.front; //BRING TO FRONT
//w.fullScreen; //FILLSCREEN
)
ParaSpaced.rtf (4 kB)
.sources.
Haines, Christian 11.09.08, "Graphical User Interface (3)," External Lecture of EMU, Adelaide University.
iieiwrmeieweeiimeemmwreiweremweireeemeimwieewwrwweereireeiimeewmiwwwemwiewimeeeremeiewmemweewieewerwemwiimiewmeiwireiiwrrewmwewree |
19.9.08
ParaSpace
copywrite 12:41 pm
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment