0.6.3 • Published 3 years ago

pap v0.6.3

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

Pap

NPM

Renders blurred versions of images to canvas.

Import the module.

const pap = require('pap')();

Load an image and draw it on a canvas.

const imageElement = document.createElement('image');

imageElement.addEventListener("load", function () {
    pap.initialize(imageElement);
    pap.blur(64);
    document.body.appendChild(pap.canvas);
});

imageElement.src = "images/kittens.jpg";

Initialize once, and update blur live.

const Pap = require('pap');
const mage = document.createElement('img');

mage.onload = function () {
    var pap = Pap();
    pap.initialize(mage);
    document.body.appendChild(pap.canvas);
    var inc = 0;
    var blurWave = function () {
        inc += 0.02;
        pap.blur(Math.sin(inc) * 32 + 32);
        requestAnimationFrame(blurWave);
    };

    blurWave();
};

mage.src = "images/kittens.jpg";
0.6.3

3 years ago

0.6.2

9 years ago

0.6.1

9 years ago

0.6.0

9 years ago

0.5.1

9 years ago

0.4.1

10 years ago

0.4.0

10 years ago

0.3.0

10 years ago

0.2.0

11 years ago

0.0.1

11 years ago