Lichen.js Basic Example
✓ Published0🌍 Public
Aandrew-reid
Last edited Apr 13, 2018
Created on Feb 6, 2018
This example demonstrates how to create a simple striped pattern using the Lichen.js library and apply it as a fill to an SVG rectangle. The code defines a `ln.stripe()` pattern with alternating crimson, yellow, and steelblue bands of varying widths. It then uses the pattern’s `.use()` method to fill a 960 by 500 SVG rectangle, leveraging D3 v4 to select the SVG element. Lichen.js generates the pattern definition in the SVG's `<defs>` section, and the example shows the basic workflow for creating and applying reusable patterns.
AI-generated descriptionA very simple demonstration of lichen.js patterns with d3.js.