Skip to content
This repository has been archived by the owner on Feb 4, 2018. It is now read-only.

Alexis-Bize/BlurredJS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 

Repository files navigation

JavaScript canvas-based image blurring engine

alt tag

Installation

You can load it via AMD, CommonJS or the object will be available on the Blurred global variable

How to use


// Instanciation
var myBlurredElement = new Blurred(document.getElementById('such-doge'));

// Blur radius/strength setting
myBlurredElement.setBlurStrength(3); 

// If there's no data-blurred attribute on your element or if you want to force the url, you can do it here
myBlurredElement.setUrl('http://wowsuchdoge.com/swag.jpg'); 

// Set mime type for better results
myBlurredElement.setMimeType('image/png');

// Set callback function
myBlurredElement.setCallback(function() {
    // Hello world
});

// Perform rendering
myBlurredElement.render();

// Get used properties (element, url, mimeType, blurStrength)
myBlurredElement.getProps(['url', 'blurStrength']);

// Destroy blurred image
myBlurredElement.destroy();

/* 

All calls, except render(), are chainable.
That way you can do 
  myBlurredElement
    .setBlurStrength(3)
    .setUrl('http://yolo.com/dickbutt.jpg')
    .setMimeType('image/jpeg')
    .setCallback(function() {
        console.log(this.getProps(['imgContainer']);
    }).render();
    
*/

Enjoy!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published