npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ink-trace/core

v0.1.0

Published

Framework-agnostic canvas ink stroke simulation.

Readme

@ink-trace/core

Framework-agnostic Canvas ink stroke simulation.

import { createInkTrace } from "@ink-trace/core";

const canvas = document.querySelector<HTMLCanvasElement>("canvas")!;
const paths = [
  {
    d: "M 200 400 C 280 320, 320 480, 400 380 C 460 320, 480 460, 560 360 C 640 280, 700 480, 800 380 C 880 300, 920 460, 1000 360",
    closed: false
  }
];

const trace = createInkTrace(canvas, {
  preset: "fountainPen",
  paths
});

trace.render();
trace.reseed();

Use settings to override preset parameters, and pass paths with SVG path data for drawing. Set viewBox when the path data comes from an existing SVG coordinate system.

Options

| Option | Type | Default | Description | | --- | --- | --- | --- | | preset | InkTracePresetName \| InkTracePreset | "fountainPen" | Built-in preset name or a full custom preset object. | | settings | InkTracePresetPatch | undefined | Partial preset overrides grouped by nib, taper, jitter, flow, drypen, splatter, and ink. | | paths | InkTracePathItem[] | [] | SVG path data items to render. | | viewBox | string \| InkTraceViewBox \| null | null | Source coordinate system, such as "0 0 1360 700" or { x, y, width, height }. | | seed | number | 1 | Deterministic variation seed. Use the same seed for repeatable output. | | progress | number | 1 | Stroke reveal progress from 0 to 1. Strokes grow in path order while keeping width, jitter, grain, and splatter stable for the same seed. | | width | number | 1360 | Canvas bitmap width. | | height | number | 700 | Canvas bitmap height. | | backgroundColor | string \| null | null | Optional canvas fill color. Leave null for transparent output. |

Animate stroke growth with play():

const trace = createInkTrace(canvas, {
  preset: "brushPen",
  paths,
  progress: 0
});

trace.play({
  strokeDuration: 1200,
  strokeDelay: 120
});

play() defaults to strokeDuration: 1200, strokeDelay: 0, and easing: "easeInOut". It accepts strokeDuration, strokeDelay, from, to, easing, onUpdate, and onFinish. strokeDuration is each path item's drawing time. strokeDelay is the start-time offset between adjacent path items; use 0 for simultaneous strokes or the same value as strokeDuration for sequential strokes. If strokeDuration is not set, duration is used as a fallback. easing defaults to "easeInOut" and can be "linear", "easeIn", "easeOut", "easeInOut", or a custom (t) => number function.

Paths

| Option | Type | Default | Description | | --- | --- | --- | --- | | d | string | Required | SVG path data. | | closed | boolean | false | Treats the path as closed for stroke tip handling. | | fill | boolean | false | Fills the path with the preset ink color instead of drawing a simulated stroke. | | label | string | undefined | Optional metadata label. | | dashArray | string \| number[] | undefined | SVG-like dash pattern, such as "40 18 42" or [40, 18, 42]. | | dashOffset | number | 0 | Offset into the dash pattern. | | pathLength | number | undefined | Reference length used to scale dash values. |

Preset Settings

Pass settings to override only the preset fields you need:

createInkTrace(canvas, {
  preset: "brushPen",
  settings: {
    nib: { width: 5 },
    ink: { color: "#111111", alpha: 0.9 },
    splatter: { intensity: 0.2 }
  },
  paths
}).render();

| Section | Fields | | --- | --- | | nib | width, angle, flatness, splitWidth, splitAlpha | | taper | variation, profile, startTip, endTip, tipStyle | | jitter | lowFreq, highFreq, pathDeform, edgeRoughness | | flow | segmentation, segmentScale, minFlow, speedSim | | drypen | grainDensity, grainLength, grainAlpha | | splatter | intensity, density, spread, sizeVariance, clustering, shape, cornerBoost, skipEnds | | ink | color, flowDarkness, hueJitter, alpha |

Allowed string values:

| Field | Values | | --- | --- | | taper.profile | "uniform", "centerHeavy", "startHeavy", "endHeavy", "tapered" | | taper.tipStyle | "sharp", "blunt", "pause", "hook" | | flow.speedSim | "none", "cornerSlow", "straightFast" | | splatter.shape | "circle", "ellipse", "mixed" |

Presets

Built-in presets are fountainPen, fineliner, brushPen, dipPen, ballpoint, marker, calligraphy, and sketch.

Controller

| Method | Description | | --- | --- | | render(options?) | Merges options and renders the canvas. | | update(options) | Alias for rendering with new options. | | reseed(seed?) | Renders with a provided seed or a random seed. | | play(options?) | Animates progress with optional strokeDuration, strokeDelay, from, to, easing, onUpdate, and onFinish. | | destroy() | Clears the canvas. |