Threshold
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.
// Each hour: wall light, wall shade, sky top, horizon glow, sky low, sunlight.
var hours = [
['#D8C9D2', '#8E7FA3', '#8DB3DE', '#F4E6BC', '#A7BDE4', '#F8EBC0'],
['#D3C6D6', '#7F76A0', '#5E9FDC', '#EEF2DA', '#86AEE0', '#F6EDC4'],
['#D1A9AD', '#6A5078', '#62609E', '#F5B67E', '#9476A6', '#F8CE96'],
['#6C6890', '#2A2844', '#1C2352', '#7482B8', '#2C356C', '#BCC6EA']
];
var hour = hours[intVariable('Hour', 1, hours.length) - 1];
var scene = s.group();
function shape(points, fill, opacity){
scene.add(s.polygon(points).attr({fill: fill, opacity: opacity || 1}));
}
// The wall: one field, lit from the opening and falling off to dusk.
var lit = getRandomInt(0, 1);
scene.add(s.rect(-20, -20, width + 40, height + 40)
.attr({fill: s.gradient('l(' + lit + ',0.3,' + (1 - lit) + ',0.8)' + hour[0] + '-' + hour[1])}));
// The opening, skewed as seen from off to one side: the near edge tall, the
// far edge shorter, and the whole of it well inside the face.
var nearX = lit ? getRandomInt(150, 220) : getRandomInt(280, 350);
var farX = lit ? getRandomInt(400, 440) : getRandomInt(60, 100);
var nearTop = getRandomInt(70, 110), nearBottom = getRandomInt(360, 400);
var farTop = nearTop + getRandomInt(10, 40), farBottom = nearBottom - getRandomInt(20, 60);
var horizon = getRandomArbitary(0.55, 0.75);
shape([nearX, nearTop, farX, farTop, farX, farBottom, nearX, nearBottom],
s.gradient('l(0,0,0,1)' + hour[2] + '-' + hour[3] + ':' + Math.round(horizon * 100) + '-' + hour[4]));
// The floor meets the sill of the opening and runs to the bottom edge,
// holding a pale reflection of the sky near the sill.
var sillLeft = nearX < farX ? [nearX, nearBottom] : [farX, farBottom];
var sillRight = nearX < farX ? [farX, farBottom] : [nearX, nearBottom];
shape([-20, height + 20, width + 20, height + 20, sillRight[0], sillRight[1], sillLeft[0], sillLeft[1]],
s.gradient('l(0,0,0,1)' + hour[0] + '-' + hour[1]));
var drop = getRandomInt(30, 70);
shape([nearX, nearBottom, farX, farBottom, farX, farBottom + drop * 0.6, nearX, nearBottom + drop],
hour[4], 0.5);
// Sunlight through the opening lies on the wall beside it, pale and tall.
var beam = getRandomInt(50, 90);
var bx = lit ? nearX - beam - getRandomInt(10, 40) : nearX + getRandomInt(10, 40);
shape([bx, nearTop + 10, bx + beam, nearTop - 10, bx + beam, nearBottom + 30, bx, nearBottom + 50],
s.gradient('l(0,0,0,1)' + hour[5] + '-' + hour[5] + ':35-' + hour[0] + ':90'), 0.4);
Copyright © 2014–2026 Logic and Matter. All rights reserved. Questions? Comments? hello@variart.io