Sg2.9
Altering the raster matrix
Recent RSS
Altering the raster matrix
From:  alikks
Date:  19. April 2007, 16:54

Every day I get a step further with Scriptographer... Slowly and slowly I'm understanding more and more... I never thought of myself as even being interested in programming, but it might be getting somewhere... Nevertheless, I'm still a complete idiot, apparently.

Here's my problem:
I'm altering the various raster scripts, I've gotten the art to do pretty much everything I wanted it to do, but now I want to screw around with the raster matrix. I wanted to start out creating a halftone matrix (45deg), basically I'd have to offset every second line by half the matrix spacing. Alternatively I'd like to explore hexagonal etc. configurations...

Any idea on how to achieve this?

Your help would be greatly appreciated...

Alexander

Re: Altering the raster matrix
From:  alikks
Date:  23. April 2007, 16:32

May I answer my own question:

include("raster.js");

if (initRaster()) {
values = prompt("Enter Raster Values:",
{type: "number", value: 2, title: "Grid Size:", width: 50},
{type: "number", value: 100, title: "Object Scale (%):", width: 50}
);
if (values) {
var size = values[0], scale = values[1] / 100.0;
var offset = values[0]/2;

function drawDot(x, y, dot, radius) {
if (radius > 0) {
var art = dot.clone();
var m = new Matrix();
var odd = y%2;
m.scale(radius * scale);
if (odd) {
m.translate(x * size + offset, y * size);
}
else {
m.translate(x * size, y * size);
}
art.transform(m);
return art;
}
return null;
}

doRaster();
}
}

Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
Lorem Ipsum Generator 25.06.11