0.6.3 • Published 2 years ago

pap v0.6.3

Weekly downloads
3
License
MIT
Repository
github
Last release
2 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

2 years ago

0.6.2

8 years ago

0.6.1

8 years ago

0.6.0

8 years ago

0.5.1

8 years ago

0.4.1

9 years ago

0.4.0

9 years ago

0.3.0

9 years ago

0.2.0

9 years ago

0.0.1

9 years ago