Coffeekraken.io 0.0.1

SSvgFilter

This class allows you to create with ease some complexe SVG filters and to apply it on any HTMLElement that you want by extending this class like so

Example

    class MyBlurFilter extends SSvgFilter {

        constructor(amount = 8) {
            super(`
                <feGaussianBlur in="SourceGraphic" stdDeviation="${amount}" result="blur" />
            `);
        }
}

// using your filter
const myFilter = new MyBlurFilter(10);
myFilter.applyTo(myCoolHTMLElement);

Author : Olivier Bossel olivier.bossel@gmail.com

Constructor

Methods

applyTo

Apply the filter to an element

Name Type Description Status Default
elm { HTMLElement } The element on which to apply the filter required

unapplyFrom

Unapply from

Name Type Description Status Default
elm { HTMLElement } The element from which to remove the filter required

destroy

Destroy the filter