View source
Pathogen · 110 lines
define ViewBox(0, 0, 6600, 1200);
define default PathLayer('base') ${
fill: #fff;
stroke: none;
}
let { width, height } = viewbox;
rect(0, 0, width, height);
let mainPLFillColor = oklch(0.9792 0.1035 107.6 / 0.075).hueShift(0.2pi);
let shadowColor = oklch(0.6573 0.2590 356.8 / 0.28).hueShift(-0.35pi).saturate(120%);
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 baseShadowStyles = ${
filter: drop-shadow(0px 0px 8px baseGlyphShadowColor);
};
let fontFamily = 'Rajdhani';
@font fontFamily;
let glyphFontColor = oklch(0.6291 0.2562 26.8);
let glyphStyles = ${
fill: glyphFontColor.alpha(28%);
font-family: fontFamily;
font-size: 128;
font-weight: 400;
stroke: glyphFontColor.alpha(72%);
stroke-width: 2;
};
let layerCounter = 1;
let textContent = `जेँ कि मानवाधिकारक अवहेलना आʼ अवमाननाक परिणाम होइछ एहन नृशंस आचरण जाहिसँ मानवक अन्तःकरण`;
let glyphs = PathBlock.fromGlyph(`What's in the workspace now? ${fontFamily} ${textContent}`, 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(-0.5pi);
let baseGlyphShadowColor = shadowColor.hueShift(0pi);
if (calc(gIndex % 2) == 0) {
baseGlyphColor = baseGlyphColor.hueShift(0.1pi);
baseGlyphShadowColor = baseGlyphShadowColor.hueShift(0.95pi).lighten(20%);
}
let contours = glyph.contours.map() {|con|
return con.fillet(1.6).scale(conScale, conScale).rotateAtVertexIndex(0, randomRange(-0.25pi, 0.25pi));
};
for ([contour, cIndex] in contours) {
let leftOffset = calc((gIndex * 48) + 260);
let topOffset = calc((cIndex * 72) + 560);
contourSet.push({
contour,
leftOffset,
topOffset,
});
for (offsetBase in 64..1) {
let offsetBase = calc(offsetBase * 1.5 + 5);
let halo = contour.variableOffset() {|vo, cpb|
let timeMax = 29;
for (time in 1..timeMax) {
let offset = randomRange(calc(offsetBase - 4.8), calc(offsetBase + 4.8));
vo.stop(calc(time / timeMax), offset, CurveContinuity.G2);
}
};
let fillColor = baseGlyphColor.hueShift(calc(offsetBase * 0.009pi));
let pl = PathLayer(`pl-${layerCounter}`) << baseMainStyles << ${
fill: fillColor;
stroke: fillColor.darken(randomRange(0.68, 0.96)).alpha(42%);
stroke-width: randomRange(0.05, 0.75);
};
if (offsetBase >= 0) {
pl.styles << ${
fill: fillColor.flatten(#fff);
} << baseShadowStyles;
}
layerCounter = layerCounter + 1;
pl.apply {
halo.drawTo(leftOffset, topOffset);
z
}
}
}
let currentGlyphColor = glyphFontColor.hueShift(randomRange(-10, 10));
let glyphLayer = PathLayer(`gl-${gIndex}`) << glyphStyles << ${
filter: `blur(${randomRange(2.4, 6.2)}px)`;
} << ${
fill: currentGlyphColor.alpha(randomRange(0.15, 0.95));
stroke: currentGlyphColor.darken(randomRange(0.65, 0.95));
};
glyphLayer.apply {
for (contourRef in contourSet) {
let { contour, leftOffset, topOffset } = contourRef;
contour.drawTo(leftOffset, topOffset);
}
}
}