Well, copy the following text to a file star.js on your hard-disk and open it with the Flowmixer (by pressing the “Load Script” button) and have a look..
The interesting parts in this script are
star=new GeometryLayer(W,H); - create a new viedeo-layerstar.activate(true); - enable rendering for the layerscr.add_layer(star); - add it to the screenaaline(x1, y1, x2, y2); - draw a simple line onto a video-layer.TriggerController(); - create a timer that executes at regular intervalls.Another good starting point is acid_geo which demonstrates keyboard-control and how to draw or rotate 2D objects.
Check out a full list of example scripts; but note that not all of them work on OSX.
star.js:
x = 100;
y = 100;
s = 30 / 0.383;
s2 = s;
PI = 3.141592654;
c = PI * 2;
o = -PI / 2;
scr = new Screen();
W = get_width();
H = get_height();
function drawStar(lay, s_mul, s2_mul) {
s = s_mul / 0.383;
s2 = s / s2_mul;
var cx;
for(cx=0; cx<10; cx++) {
k = cx/10;
kn = k+0.1;
x1 = x+s * Math.cos(o + k*c);
y1 = y+s * Math.sin(o + k*c);
x2 = x+s2 * Math.cos(o + kn*c);
y2 = y+s2 * Math.sin(o + kn*c);
x1 = Math.floor(x1);
y1 = Math.floor(y1);
x2 = Math.floor(x2);
y2 = Math.floor(y2);
lay.aaline(x1, y1, x2, y2);
}
}
var star;
star = new GeometryLayer(W,H);
star.color(255,255,255,255);
star.activate(true);
scr.add_layer(star);
drawStar(star,30,1);
srand();
cc = 1;
var star_bang;
star_bang = new TriggerController();
register_controller(star_bang);
star_bang.frame = function() {
cc += 0.05;
star.color(rand()%255, rand()%255, rand()%255, 0xff);
drawStar(star, 30, Math.sin(cc));
if(cc>4.0) {
cc = 1;
srand();
}
}