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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@thi.ng/canvas

v1.1.3

Published

Canvas creation & HDPI support helpers

Readme

@thi.ng/canvas

npm version npm downloads Mastodon Follow

[!NOTE] This is one of 211 standalone projects, maintained as part of the @thi.ng/umbrella monorepo and anti-framework.

🚀 Please help me to work full-time on these projects by sponsoring me on GitHub. Thank you! ❤️

About

Canvas creation & HDPI support helpers.

This package provides small frequently used helpers for HTML Canvas 2D creation & resizing:

Status

STABLE - used in production

Search or submit any issues for this package

Note: Some functions were previously part of the thi.ng/adapt-dpi and thi.ng/pixel packages, but have been migrated to this package for better/smaller re-use...

Installation

yarn add @thi.ng/canvas

ESM import:

import * as can from "@thi.ng/canvas";

Browser ESM import:

<script type="module" src="https://esm.run/@thi.ng/canvas"></script>

JSDelivr documentation

Package sizes (brotli'd, pre-treeshake): ESM: 403 bytes

Dependencies

None

Usage examples

27 projects in this repo's /examples directory are using this package:

| Screenshot | Description | Live demo | Source | |:----------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------|:-----------------------------------------------------------|:----------------------------------------------------------------------------------------| | | Interactive & reactive image blurhash generator | Demo | Source | | | Self-modifying, animated typographic grid with emergent complex patterns | Demo | Source | | | Polygon point classification (inside/boundary/outside) | Demo | Source | | | Shape conversions & operations using polygons with holes | Demo | Source | | | Embedding thi.ng/hiccup data/elements in thi.ng/geom shape hierarchies | Demo | Source | | | geom-fuzz basic shape & fill examples | Demo | Source | | | Iterating the unique edges of a tessellation | Demo | Source | | | Visualization of different grid iterator strategies | Demo | Source | | | Basic hiccup-based canvas drawing | Demo | Source | | | Barnsley fern IFS fractal renderer | Demo | Source | | | Optical flow analysis of web cam or video inputs | Demo | Source | | | Pixel buffer manipulations | Demo | Source | | | Showcase of various dithering algorithms | Demo | Source | | | Image dithering and remapping using indexed palettes | Demo | Source | | | Normal map creation/conversion basics | Demo | Source | | | RGB waveform image analysis | Demo | Source | | | Animated, iterative polygon subdivisions & visualization | Demo | Source | | | Port-Duff image compositing / alpha blending | Demo | Source | | | Steering behavior drawing with alpha-blended shapes | Demo | Source | | | Basic 2D scenegraph example with pan/zoom functionality | Demo | Source | | | Entity Component System w/ 100k 3D particles | Demo | Source | | | Visual comparison of biased vs. unbiased normal vectors projected on the surface of a sphere | Demo | Source | | | WebGL cube maps with async texture loading | Demo | Source | | | WebGL instancing, animated grid | Demo | Source | | | WebGL MSDF text rendering & particle system | Demo | Source | | | Minimal multi-pass / GPGPU example | Demo | Source | | | Interactively drawing to & reading from a WebGL offscreen render texture | Demo | Source |

API

Generated API docs

TODO

Authors

If this project contributes to an academic publication, please cite it as:

@misc{thing-canvas,
  title = "@thi.ng/canvas",
  author = "Karsten Schmidt",
  note = "https://thi.ng/canvas",
  year = 2023
}

License

© 2023 - 2025 Karsten Schmidt // Apache License 2.0