The original shape or image is stored initially in a PGraphics or PImage. The first step involved setting up the grid for the tiling system, which was then used to access a two-dimensional for-loop.
int tilingX = 1000;
int tilingY = tilingX;
int wX = p.width/tilingX;
int wY = p.height/tilingY;
for (int y = 0; y < tilingY; y++) {
for (int x = 0; x < tilingX; x++) {
The diagonal and expanding blurring/tiling effect is achieved by displacing the source x and y position with noise scaled by the pixel’s placement on the grid. Larger noise values result in lighter, more sparse textures.
//Source pixel position int sx = int((x*wX) + random(50)*sin((x+y))); int sy = int((y*wY) - random(50)*sin((x+y))); int sw = wX; int sh = wY;
The pixels are than pasted into a destination matrix, and different source formulas can be used to achieve varied geometric patterns and textures.
//Destination pixel position
int dx = x*wX;
int dy = y*wY;
int dw = wX;
int dh = wY;
copy(sx, sy, sw, sh, dx, dy, dw, dh);