Nullsoft AVS Preset 0.2ÙÕVARIABLES.
gr: Grid resolution. This is the approximate ratio of screen pixels to grid pixels. You can set it to 1 to get dot-for-dot, but it may be slow. Also be aware that the AVS limits n to some maximum I haven't bothered to figure out yet, so you may not be able to fill the full screen with gr less than three. It is possible to dynamically vary this value, but the xc/yc/n calculations must be redone afterward. Lastly note that going fullscreen doesn't force this recalculation, so it is necessary to temporarily switch to another preset to get the resolution right.
xc/yc: Number of columns/rows in the grid. The "| 0" at the end of the expression forces it to be an integer. I found this trick in one of Justin's SPS presets; it seems to work better than floor().
frame: Current frame count, as an integer.
xi/yi: Current column/row number. Don't use these directly because they overscan the screen a bit and alternate directions every row.
xv/yv: Use these instead for column/row number. They range between 0 (inclusive) and xc/yc (exclusive), and they're always integers.
xf/yf: Or use these. They range between -1 (inclusive) and 1 (exclusive, but not by much).
ra: Distance from the center of the image. The value at the center is 0. At the top, bottom, left, or right center edge, 1. In the corners, 1/sqrt(2).
th: Angle in degrees from the center of the image. 0 is right, 90 is up, +/-180 is left, and -90 is down.
sun0/sun1: True (1) if inside first/second spiral.
star: True if inside the starfish pattern.
Rasterization starts at the upper lefthand corner, proceeds to the upper right, then moves straight down to the next line, continues to the left, and repeats until the lower right is reached. This pattern avoids retraces which may overwrite previously drawn pixels.
To clearly see the alternating rasterization, set gr to 1 and switch from line mode to dot mode. Every other scan line will appear horizontally shifted one pixel.$Œàx = xi / (xc - 1) * 2 - 1;
y = (yi + 0.5) / yc * 2 - 1;
linesize = h / yc + 1;
ra = sqrt(sqr(xf) + sqr(yf));
th = atan2(yf, xf) * 180 / $PI + 360;
sun0 = below((ra * 80 + frame + th) % 40, 20);
sun1 = below((ra * 80 - frame - th) % 40, 20);
star = below((frame + ra * 160 + sin((frame - th) * $PI / 36) * 10 + 10) % 50, 25);
red = abs(abs(sun0 - sun1) - star);
green = red;
blue = red;
if(equal(yi % 2, 0),
exec2(assign(xi, xi + 1), if(equal(xi, xc), exec2(assign(xi, xc - 1), assign(yi, yi + 1)), exec2(assign(xv, xi), assign(yv, yi)))),
exec2(assign(xi, xi - 1), if(equal(xi, -1), exec2(assign(xi, 0), assign(yi, yi + 1)), exec2(assign(xv, xi + 1), assign(yv, yi)))));
xf = xv / xc * 2 - 1;
yf = yv / yc * 2 - 1;Exi = 0; xv = 0; xf = 0;
yi = 0; yv = 0; yf = 0;
frame = frame + 1;Fgr = 3;
xc = w / gr | 0;
yc = h / gr | 0;
n = xc * yc;
frame = 0;ÿÿÿ