Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/orouz/pictwist
twist rgba values of pixels in image elements
https://github.com/orouz/pictwist
canvas images javascript
Last synced: 1 day ago
JSON representation
twist rgba values of pixels in image elements
- Host: GitHub
- URL: https://github.com/orouz/pictwist
- Owner: orouz
- Created: 2017-04-15T17:46:46.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-06-21T18:34:40.000Z (over 7 years ago)
- Last Synced: 2024-10-11T20:36:59.567Z (about 1 month ago)
- Topics: canvas, images, javascript
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PicTwist 🖼️ 🔀 🌈
### twist RGBA values of pixels in image elements
## Usage
```
import Pictwist from 'pictwist'/* get img elements to play with */
const imgs = Array.from(document.querySelectorAll('img'))/*
set a transform function for each color property
that returns an integer between 0-256
you get the current value as the only argument of the function
*/
const options = {
red: x => 256 // will set pixels to red
blue: x => Math.random() * 256, // will set the blue pixels to a random color
green: x => x // default, does nothing (optional)
alpah: x => x // same
}/* run it */
imgs.forEach(img => new Pictwist(img, options))```