Open as new workspace
Simplify halo rendering and blend to increase saturation by Ryan

Simplify halo rendering and blend to increase saturation

View source Pathogen · 80 lines
define ViewBox(0, 0, 880, 280);
define default PathLayer('base') ${ fill: oklch(0.9598 0.0200 84.6); stroke: none;};
rect(0, 0, 880, 280);

let mainPLFillColor = (oklch(0.9792 0.1035 107.6 / 0.1)).hueShift(0.45pi);
let shadowColor = (oklch(0.6573 0.2590 356.8 / 0.32)).hueShift(-0.2pi);
let baseMainStyles = ${
  fill: mainPLFillColor;
  stroke: mainPLFillColor.darken(84%).alpha(72%);
  stroke-width: 0.1;
};

let dropShadowStyle = ${
  filter: drop-shadow(4px 4px 4px shadowColor);
};

let mainPathLayer = PathLayer('main-path-layer') << baseMainStyles;
let glyphLayerStyles = ${
  fill: (oklch(0.3397 0.0641 77.6 / 0.84)).lighten(20%).hueShift(-0.75pi);
  stroke: #667a;
  stroke-width: 0.1;
  filter: blur(2px);
};

let fontFamily = 'Merriweather';
@font fontFamily;
let glyphFontColor = oklch(0.3302 0.0678 109.6);
let fontStyles = ${
  fill: glyphFontColor.alpha(32%);
  font-family: fontFamily;
  font-size: 32;
  font-weight: 400;
  stroke: glyphFontColor.alpha(92%);
  stroke-width: 0.25;
};

let layerCounter = 1;
let glyphs = PathBlock.fromGlyph('pathogen studio', fontStyles);
// let glyphs = PathBlock.fromGlyph('Joaquin.Kuykendall', fontStyles);
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.75, 2);
  
  for ([contour, cIndex] in glyph.contours.map() {|con|
    return con.fillet(1.6).scale(conScale, conScale);
  }) {
    let leftOffset = calc(60 + gIndex * 48);
    // contourSet.push({contour, leftOffset}); //-- THIS DOESN'T WORK!!! FIX IT!!!
    contourSet.push({contour: contour, leftOffset: leftOffset});

    for (offsetBase in 1..42) {
      let offsetBase = calc(offsetBase * 1.2 + 5);
      let halo = contour.variableOffset() {|vo, cpb|
        let timeMax = 9;
        for (time in 1..timeMax) {
          let offset = randomRange(calc(offsetBase - 2), calc(offsetBase + 2));
          vo.stop(calc(time / timeMax), offset, CurveContinuity.G2);
        }
      };
      let pl = PathLayer(`pl-${layerCounter}`) << baseMainStyles << dropShadowStyle;
      layerCounter = layerCounter + 1;
      pl.apply {
        halo.drawTo(leftOffset, 140);
        z
      }
    }

  }

  let glyphLayer = PathLayer(`gl-${gIndex}`) << glyphLayerStyles << ${ filter: `blur(${randomRange(1.1, 1.8)}px)`; };
  glyphLayer.apply {
    for (contourRef in contourSet) {
      let {contour, leftOffset} = contourRef;
      contour.drawTo(leftOffset, 140);
    }
  }
}