«Cheap Screen Saver (randomness free)» by rukano

on 11 May'12 15:05 in cheapscreen saveranimation

Messing around with pen, trying not to use randomness. Turned out like a 90's screen saver.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
w = Window("screensaver", Window.screenBounds).front.fullScreen;
w.view.keyDownAction = { w.close };
u = UserView(w, w.view.bounds);
u.background = Color.black;
u.animate = true;
u.clearOnRefresh = false;
u.drawFunc = { |u|
	var width = u.bounds.width;
	var height = u.bounds.height;
	var size = 2;
	Pen.fillColor = Color.black.alpha_(sin(u.frame).abs/100);
	Pen.fillRect(u.bounds);
	Pen.strokeColor = Color(u.frame/1e3%1,sin(u.frame/100).abs,cos(u.frame/666).abs,0.1);
	Pen.rotate(u.frame/(360/4), width/2, height/2);
	Pen.scale(size, size);
	Pen.use{
		Pen.moveTo(Point(0,0));
		100.do{ |i| Pen.lineTo(Point(u.frame * cos(i) % 400, u.frame / sin(i) % 400)) };
		Pen.stroke;
	};
};
descendants
«Re: Cheap Screen Saver (randomness free)» by LFSaw (private)
full graph
raw 702 chars (focus & ctrl+a+c to copy)
reception
comments
rukano user 11 May'12 15:08

Ah yes... a little timer function wich triggers this script after 5 minutes of inactivity would be awesome... ;)

Fredrik Olofsson user 11 May'12 16:22

very nice one Juan! also, do you know you can directly use u.frame instead of your q.frames counter? i.e. userviews already have a built-in frame counter. and i think i benchmarked 10@20 to be a bit slower than doing Point(10, 20). maybe worth considering. great work.

rukano user 11 May'12 16:28

Thanks! I knew there was a frame counter but didn't found it straight away, I was thinking it was being passed in the draw func, but u.frame is nice and now implemented. 2 less lines :) Ah, and the Point() optimisation will be done too :) Thanks for the suggestions!

beryann.parker user 14 May'12 14:26

ouah!! very beautiful!! it would be great if we could insert line of sound codes inside the "screen saver" and make it run WITH it (a little bit like in Fluxus)....anyway awesome Juan!!