-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d7c642c
commit ac75144
Showing
1 changed file
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# dither-dither | ||
|
||
[demo](https://fidelthomet.github.io/dither-dither/) | ||
|
||
`npm i dither-dither` | ||
|
||
`import 'dither-dither'` | ||
|
||
`<dither-dither src="…"></dither-dither>` | ||
|
||
## What? | ||
This is a web component for monochrome dithering. It works on images and videos. It's based on shaders and should be quite fast. It uses a blue noise threshold map. But you can also specify a custom threshold map. | ||
|
||
## Why? | ||
- looks nice | ||
- small media files – in most cases you'll get away with using [images](https://github.com/fidelthomet/dither-dither/blob/main/public/hermannstrasse.jpg) and [videos](https://github.com/fidelthomet/dither-dither/blob/main/public/hermannstrasse.mp4) of atrocious quality | ||
|
||
## How? | ||
install the package through npm | ||
```sh | ||
npm i dither-dither | ||
``` | ||
|
||
import in javascript… | ||
```js | ||
import 'dither-dither' | ||
``` | ||
…or directly in your html file | ||
```html | ||
<script type="module">import "dither-dither";</script> | ||
``` | ||
|
||
use | ||
```html | ||
<!-- images --> | ||
<dither-dither src="./hermannstrasse.jpg"></dither-dither> | ||
|
||
<!-- videos (the `video` attribute can be omitted for filenames ending in .mp4, .webm, .ogg) --> | ||
<dither-dither src="./hermannstrasse.mp4" video></dither-dither> | ||
|
||
<!-- custom threshold map --> | ||
<dither-dither src="./hermannstrasse.jpg" threshold-map="./bayer8x8.png"></dither-dither> | ||
|
||
<!-- cross origin, sets cross origing mode to `anonymous` see: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/crossOrigin --> | ||
<dither-dither cross-origin src="https://…"></dither-dither> | ||
``` | ||
|
||
|
||
## Development | ||
|
||
```sh | ||
npm install | ||
``` | ||
|
||
### Compile and Hot-Reload for Development | ||
|
||
```sh | ||
npm run dev | ||
``` | ||
|
||
### Compile and Minify Library | ||
|
||
```sh | ||
npm run build | ||
``` | ||
|
||
### Compile and Minify static Page | ||
|
||
```sh | ||
npm run build:site | ||
``` | ||
|
||
### Lint with [ESLint](https://eslint.org/) | ||
|
||
```sh | ||
npm run lint | ||
``` |