Chroma Drift
to generate a new and unique variation
Every variart piece is a small program. This is the one that drew what you're looking at.
var paper = '#F2EFE9';
var grounds = ['#16121A', '#F7F5F0'];
var ramps = [
['#3B1F57', '#5B3C9E', '#3E6ED6', '#35A6D8', '#86D2CB'],
['#F6C746', '#F4A12B', '#EC5A2E', '#C4393F', '#8A2C4B']
];
var margin = 50;
var columns = intVariable('Columns', 5, 12);
var band = intVariable('Band', 10, 28);
s.rect(0, 0, width, height).attr({fill: paper});
var field = width - margin * 2;
var w = field / columns;
var slant = w * 0.9;
// Everything is drawn inside the field, clipped so slanted bands end flush.
var clip = s.rect(margin, margin, field, field);
var g = s.group().attr({clipPath: clip});
function band_(x, y, fill){
g.add(s.polygon(x, y + slant, x + w, y, x + w, y + band, x, y + slant + band).attr({fill: fill}));
}
// One schedule of grounds and runs shared by every column, so neighbours echo
// each other and the runs read as zig-zags across the sheet.
var blocks = [];
var y = -200, ground = getRandomInt(0, 1);
while (y < height + 200){
var h = getRandomInt(60, 180);
blocks.push({y: y, h: h, fill: grounds[ground]});
ground = 1 - ground;
y += h;
}
var runs = [];
y = -300;
while (y < height + 200){
var ramp = ramps[getRandomInt(0, 1)].slice();
if (getRandomInt(0, 1)) { ramp.reverse(); }
runs.push({y: y, ramp: ramp});
y += ramp.length * band + getRandomInt(1, 5) * band;
}
// Each column slides the schedule a little up or down from its neighbour.
var shift = 0;
for (var c = 0; c < columns; c++){
var x = margin + c * w;
shift += getRandomInt(-2, 2) * band;
blocks.forEach(function(b){
g.add(s.rect(x, b.y + shift, w + 0.5, b.h).attr({fill: b.fill}));
});
runs.forEach(function(r){
for (var i = 0; i < r.ramp.length; i++){
band_(x, r.y + shift + i * band, r.ramp[i]);
}
});
}
Copyright © 2014–2026 Logic and Matter. All rights reserved. Questions? Comments? hello@variart.io