View source
Pathogen · 120 lines
define ViewBox(0, 0, 7600, 5600);
define default PathLayer('base') ${
fill: #fff;
stroke: none;
}
let { width, height } = viewbox;
rect(0, 0, width, height);
let mainPLFillColor = oklch(0.8002 0.2400 143.0 / 0.08).hueShift(0.2pi);
let baseMainStyles = ${
fill: mainPLFillColor;
stroke: mainPLFillColor.darken(84%).alpha(64%);
stroke-width: 0.3;
filter: drop-shadow(0px 0px 8px shadowColor);
};
let mainPathLayer = PathLayer('main-path-layer') << baseMainStyles;
let fontFamily = 'Kumar One';
@font fontFamily;
let glyphFontColor = oklch(0.6802 0.1531 0.8);
let glyphStyles = ${
fill: glyphFontColor.alpha(28%);
font-family: fontFamily;
font-size: 128;
font-weight: 400;
stroke: glyphFontColor.alpha(72%);
stroke-width: 2;
};
let theText = `કેમ કે માનવ અધિકારોની ઉપેક્ષા અને અપમાન કરવાથી એવાં જંગલી કત્યો પરિણમ્યાં છે કે જેણે`;
let layerCounter = 1;
let glyphs = PathBlock.fromGlyph(`${theText}`, glyphStyles);
for ([glyph, gIndex] in glyphs) {
// Capture generated contours so that they can later be added to a higher
// z-index layer
let contourSet = [];
let conScale = randomRange(0.95, 4);
let baseGlyphColor = mainPLFillColor.hueShift(0pi);
if (calc(gIndex % 2) == 0) {
baseGlyphColor = baseGlyphColor.hueShift(0.2pi);
}
let contours = glyph.contours.map() {|con|
let recon = con;
for (ext in 1..8) {
let start = random() * 0.899;
let end = calc(start + 0.1);
let norm1 = con.normal(start);
let norm2 = con.normal(end);
let extWidth = randomRange(0.5, 6.0);
let extLength = randomRange(72, 96);
recon = recon.subPath(0, start) << @{
heading(norm1.angle);
tangentLine(extLength);
tangentArc(extWidth, 0.5pi);
tangentLine(extWidth);
tangentArc(extWidth, 0.5pi);
tangentLine(extLength);
} << recon.subPath(end, 1) << @{ z };
}
return recon.fillet(16).scale(conScale, conScale).rotateAtVertexIndex(0, randomRange(-0.25pi, 0.25pi));
};
for ([contour, cIndex] in contours) {
let leftOffset = calc((gIndex * 64) + 840);
let topOffset = calc((cIndex * 1040) + 1820);
contourSet.push({
contour,
leftOffset,
topOffset,
});
for (offsetBase in 84..1) {
let offsetBase = calc(offsetBase * 1.75 + 5);
let halo = contour.variableOffset() {|vo, cpb|
let timeMax = 11;
for (time in 1..timeMax) {
let offset = randomRange(calc(offsetBase - 3.6), calc(offsetBase + 3.6));
vo.stop(calc(time / timeMax), offset, CurveContinuity.G2);
}
};
let fillColor = baseGlyphColor.hueShift(calc(offsetBase * 0.005pi));
let pl = PathLayer(`pl-${layerCounter}`) << baseMainStyles << ${
fill: fillColor;
stroke: fillColor.darken(randomRange(0.68, 0.96)).alpha(62%);
stroke-width: randomRange(0.05, 2.25);
};
if (offsetBase >= 12) {
pl.styles << ${
fill: fillColor.flatten(#fff);
};
}
layerCounter = layerCounter + 1;
pl.apply {
halo.drawTo(leftOffset, topOffset);
z
}
}
}
let currentGlyphColor = oklch(0.7320 0.1843 53.6);
let glyphLayer = PathLayer(`gl-${gIndex}`) << glyphStyles << ${
fill: currentGlyphColor;
stroke: currentGlyphColor.darken(randomRange(0.65, 0.95));
stroke-width: randomRange(0.5, 2.5);
};
glyphLayer.apply {
for (contourRef in contourSet) {
let { contour, leftOffset, topOffset } = contourRef;
contour.rotateAtVertexIndex(0, 0.25pi).scale(1.2, 1.8).drawTo(leftOffset, topOffset);
}
}
}