https://github.com/searls/pixel-killer
Makes pixels in a browser window look like they're dead 👾
https://github.com/searls/pixel-killer
Last synced: 2 months ago
JSON representation
Makes pixels in a browser window look like they're dead 👾
- Host: GitHub
- URL: https://github.com/searls/pixel-killer
- Owner: searls
- Created: 2022-04-15T15:44:26.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-04-16T02:35:43.000Z (about 3 years ago)
- Last Synced: 2025-02-28T14:11:16.597Z (3 months ago)
- Language: JavaScript
- Size: 46.9 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pixel-killer
```
______ __ __ __ ______ __
/\ == \ /\ \ /\_\_\_\ /\ ___\ /\ \
\ \ _-/ \ \ \ \/_/\_\/_ \ \ __\ \ \ \____
\ \_\ \ \_\ /\_\/\_\ \ \_____\ \ \_____\
\/_/ \/_/ \/_/\/_/ \/_____/ \/_____/__ __ __ __ __ ______ ______
/\ \/ / /\ \ /\ \ /\ \ /\ ___\ /\ == \
\ \ _"-. \ \ \ \ \ \____ \ \ \____ \ \ __\ \ \ __<
\ \_\ \_\ \ \_\ \ \_____\ \ \_____\ \ \_____\ \ \_\ \_\
\/_/\/_/ \/_/ \/_____/ \/_____/ \/_____/ \/_/ /_/```
Have you ever wanted to simulate dead pixels on a web page? I can't imagine why.
Here, [have a demo and kill some
pixels](https://searls.github.io/pixel-killer/).## Install
```
$ npm i -S pixel-killer
```Then `const pixelKiller = require('pixel-killer')` or `import * as pixelKiller
from 'pixel-killer'`.## Usage
### killPixelAtWindowPosition(x, y)
This function will kill a pixel at the given **window coordinates**
and will update as the window is scrolled, moved, and resized:```js
pixelKiller.killPixelAtWindowPosition(100, 100)
```### killPixelAtScreenPosition(x, y)
This function will kill a pixel at the given **screen coordinates**
(even if that pixel is outside the current window; if the window is moved over
that screen position, the dead pixel will then be rendered). It will also update as
the window is scrolled, moved, and resized:```js
pixelKiller.killPixelAtScreenPosition(100, 100)
```### killRandomPixelOnWindow()
Invoke `killPixelAtWindowPosition` at a random location on the window:
```js
pixelKiller.killRandomPixelOnWindow()
```### killRandomPixelOnScreen()
Invoke `killPixelAtScreenPosition` at a random location on the screen:
```js
pixelKiller.killRandomPixelOnScreen()
```### reset()
Remove your dead pixels. In order to track the pixels' location relative to
window resize and movement, this will also remove event listeners and polling
intervals.```js
pixelKiller.reset()
```