1.0.3 • Published 9 months ago

@9am/img-halftone v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Features

  • 🎨 Print halftone image with CMYK.
  • ⚙️ Halftone is performed in web worker.
  • 📜 Render with Canvas or HTML element.
  • 🧩 Various dot shapes supported.
  • 🔖 Alt support for Accessibility.
  • 🛎 A loading className on the host.
  • 💽 ≈ 3kB minzipped.

Demo

DescriptionLive demo
Default setting with a zoom-in-out animationcodepen
Render with different varientcodepen
Render with different cellsizecodepen
Render with different shapecodepen
Concurrent processingcodepen

Usage

Install

npm install @9am/img-halftone
import '@9am/img-halftone'

Or use a CDN link

<script type="module" src="https://cdn.skypack.dev/@9am/img-halftone"></script>
<script src="https://www.unpkg.com/@9am/img-halftone"></script>

HTML

<img-halftone src="img.png"></img-halftone>

Documentation

<img-halftone> attributes

NameTypeDefaultDescription
src{string}RequiredThe image URL
alt{string}img-halftoneThe alternative text description
varient{canvas | grid}canvasThe Render type (Notice: using 'grid' with small cellsize will cause layout performance problem.)
cellsize{number}4The cell size for each dot in pixel
shape{circle | triangle | rectangle | hexagon }circleThe shape of dots

License

MIT

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago