On 18 Dec 2007, at 14:56, Jan T wrote:
Hi Jan thanks for this!! Exactly what I needed. But I desperately also need the clear method. Can you easily add a .clear? Check the following: (it draws on top of the other drawing. If I then set clearOnRefresh to true, it removes the drawing when the window is refreshed) cheers thor ( var dropcount, drawer; dropcount = 16; c = true; a = Array.fill(dropcount, {80.rand}); w = SCWindow("drops", Rect(211, 311, 820, 343)).front; drawer = SCUserView(w, Rect(120, 5, 680, 200)) .canFocus_(false) .relativeOrigin_(true) .drawFunc_({ |view| if(c == true, { \drawing.postln; Pen.color = Color.rand; 16.do({ |i| a.do({ |steps, ix| steps.do({ |iy| Pen.line( Point( (ix*(680/dropcount)), 3.5+(((iy+1)*(192/steps))).round(1)), Point( (ix*(680/dropcount))+(680/dropcount), 3.5+(((iy+1)*(192/steps))).round(1)) ); }); }); }); Pen.stroke; c = false; }); }) .clearOnRefresh_(false); ) c = true a = Array.fill(16, {80.rand}); w.refresh; |