New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@pixi/filter-zoom-blur

Package Overview
Dependencies
Maintainers
3
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/filter-zoom-blur - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

56

lib/filter-zoom-blur.es.js
/*!
* @pixi/filter-zoom-blur - v2.0.2
* Compiled Wed, 11 Oct 2017 19:50:18 UTC
* @pixi/filter-zoom-blur - v2.1.0
* Compiled Thu, 12 Oct 2017 13:21:44 UTC
*

@@ -13,3 +13,3 @@ * pixi-filters is licensed under the MIT License.

var fragment = "varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uViewSize;\nuniform vec2 uCenter;\nuniform float uStrength;\nuniform float uInnerRadius;\nuniform float uRadius;\n\n\nfloat random(vec3 scale, float seed) {\n // use the fragment position for a different seed per-pixel\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main() {\n\n vec2 texCoord = gl_FragCoord.xy / uViewSize.xy;\n texCoord.y = 1.0 - texCoord.y;\n\n vec2 center = uCenter.xy / uViewSize.xy;\n vec2 dir = vec2(center - texCoord);\n\n dir.x *= uViewSize.x / uViewSize.y;\n\n float dist = length(dir);\n\n float strength = uStrength;\n\n // randomize the lookup values to hide the fixed number of samples\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n const float count = 32.0;\n float countLimit = count;\n\n float minGradient = uInnerRadius * 0.3;\n float gradient = uRadius * 0.3;\n\n float innerRadius = (uInnerRadius + minGradient * 0.5) / uViewSize.y;\n float radius = (uRadius - gradient * 0.5) / uViewSize.y;\n\n float delta = 0.0;\n float gap;\n if (dist < innerRadius) {\n delta = innerRadius - dist;\n gap = minGradient;\n } else if (dist > radius) {\n delta = dist - radius;\n gap = gradient;\n }\n\n if (delta > 0.0) {\n float normalCount = gap / uViewSize.y;\n delta = (normalCount - delta) / normalCount;\n countLimit *= delta;\n strength *= delta;\n if (countLimit < 1.0)\n {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n }\n\n dir *= strength;\n\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n for (float t = 0.0; t < count; t++) {\n float percent = (t + offset) / count;\n float weight = 4.0 * (percent - percent * percent);\n vec2 p = vTextureCoord + dir * percent;\n vec4 sample = texture2D(uSampler, p);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n sample.rgb *= sample.a;\n\n color += sample * weight;\n total += weight;\n\n if (t > countLimit){\n break;\n }\n }\n\n gl_FragColor = color / total;\n\n // switch back from pre-multiplied alpha\n gl_FragColor.rgb /= gl_FragColor.a + 0.00001;\n}\n";
var fragment = "varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform vec2 uCenter;\nuniform float uStrength;\nuniform float uInnerRadius;\nuniform float uRadius;\n\nfloat random(vec3 scale, float seed) {\n // use the fragment position for a different seed per-pixel\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main() {\n\n vec2 center = uCenter.xy / filterArea.xy;\n vec2 dir = vec2(center - vTextureCoord);\n float dist = length(vec2(dir.x, dir.y * filterArea.y / filterArea.x));\n\n float strength = uStrength;\n\n const float count = 32.0;\n float countLimit = count;\n\n float minGradient = uInnerRadius * 0.3;\n float gradient = uRadius * 0.3;\n\n float innerRadius = (uInnerRadius + minGradient * 0.5) / filterArea.x;\n float radius = (uRadius - gradient * 0.5) / filterArea.x;\n\n float delta = 0.0;\n float gap;\n if (dist < innerRadius) {\n delta = innerRadius - dist;\n gap = minGradient;\n } else if (dist > radius) {\n delta = dist - radius;\n gap = gradient;\n }\n\n if (delta > 0.0) {\n float normalCount = gap / filterArea.x;\n delta = (normalCount - delta) / normalCount;\n countLimit *= delta;\n strength *= delta;\n if (countLimit < 1.0)\n {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n }\n\n // randomize the lookup values to hide the fixed number of samples\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n float total = 0.0;\n vec4 color = vec4(0.0);\n\n dir *= strength;\n\n for (float t = 0.0; t < count; t++) {\n float percent = (t + offset) / count;\n float weight = 4.0 * (percent - percent * percent);\n vec2 p = vTextureCoord + dir * percent;\n vec4 sample = texture2D(uSampler, p);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n sample.rgb *= sample.a;\n\n color += sample * weight;\n total += weight;\n\n if (t > countLimit){\n break;\n }\n }\n\n gl_FragColor = color / total;\n\n // switch back from pre-multiplied alpha\n gl_FragColor.rgb /= gl_FragColor.a + 0.00001;\n}\n";

@@ -23,6 +23,6 @@ /**

* @memberof PIXI.filters
* @param {number} [strength=2] Sets the strength of the zoom blur effect
* @param {number} [strength=0.1] Sets the strength of the zoom blur effect
* @param {PIXI.Point|number[]} [center=[0,0]] The center of the zoom.
* @param {number} [innerRadius=0] The inner radius of zoom. The part in inner circle won't apply zoom blur effect.
* @param {number} [radius=1E9] Very very large outer radius of the zoom.
* @param {number} [radius=1E8] Outer radius of the zoom, The default value is very very large.
*/

@@ -34,3 +34,3 @@ var ZoomBlurFilter = (function (superclass) {

if ( innerRadius === void 0 ) innerRadius = 0;
if ( radius === void 0 ) radius = 1E9;
if ( radius === void 0 ) radius = 1E8;

@@ -43,6 +43,2 @@ superclass.call(this, vertex, fragment);

this.radius = radius;
this._defaultSize = new Float32Array([0, 0]);
this._size = new Float32Array([0, 0]);
this.clearSize();
}

@@ -57,40 +53,2 @@

/**
* Apply the filter
* @override
* @private
*/
ZoomBlurFilter.prototype.apply = function apply (filterManager, input, output, clear)
{
// Apply the input source if view is not set
if (!this._customSize)
{
this._defaultSize[0] = input.sourceFrame.width;
this._defaultSize[1] = input.sourceFrame.height;
}
filterManager.applyFilter(this, input, output, clear);
};
/**
* Set the view size, if defining a region.
* @method
* @param {number} width - Width of the view size
* @param {number} height - Height of the view size
*/
ZoomBlurFilter.prototype.setSize = function setSize (width, height) {
this._customSize = true;
this._size[0] = width;
this._size[1] = height;
this.uniforms.uViewSize = this._size;
};
/**
* Clear the defined view size of the region to effect.
* @method
*/
ZoomBlurFilter.prototype.clearSize = function clearSize () {
this._customSize = false;
this.uniforms.uViewSize = this._defaultSize;
};
/**
* Center of the effect.

@@ -138,3 +96,3 @@ *

* @member {number}
* @default 1E9
* @default 1E8
*/

@@ -141,0 +99,0 @@ prototypeAccessors.radius.get = function () {

6

lib/filter-zoom-blur.es.min.js
/*!
* @pixi/filter-zoom-blur - v2.0.2
* Compiled Wed, 11 Oct 2017 19:50:18 UTC
* @pixi/filter-zoom-blur - v2.1.0
* Compiled Thu, 12 Oct 2017 13:21:44 UTC
*

@@ -8,3 +8,3 @@ * pixi-filters is licensed under the MIT License.

*/
var vertex="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n",fragment="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uViewSize;\nuniform vec2 uCenter;\nuniform float uStrength;\nuniform float uInnerRadius;\nuniform float uRadius;\n\n\nfloat random(vec3 scale, float seed) {\n // use the fragment position for a different seed per-pixel\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main() {\n\n vec2 texCoord = gl_FragCoord.xy / uViewSize.xy;\n texCoord.y = 1.0 - texCoord.y;\n\n vec2 center = uCenter.xy / uViewSize.xy;\n vec2 dir = vec2(center - texCoord);\n\n dir.x *= uViewSize.x / uViewSize.y;\n\n float dist = length(dir);\n\n float strength = uStrength;\n\n // randomize the lookup values to hide the fixed number of samples\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n const float count = 32.0;\n float countLimit = count;\n\n float minGradient = uInnerRadius * 0.3;\n float gradient = uRadius * 0.3;\n\n float innerRadius = (uInnerRadius + minGradient * 0.5) / uViewSize.y;\n float radius = (uRadius - gradient * 0.5) / uViewSize.y;\n\n float delta = 0.0;\n float gap;\n if (dist < innerRadius) {\n delta = innerRadius - dist;\n gap = minGradient;\n } else if (dist > radius) {\n delta = dist - radius;\n gap = gradient;\n }\n\n if (delta > 0.0) {\n float normalCount = gap / uViewSize.y;\n delta = (normalCount - delta) / normalCount;\n countLimit *= delta;\n strength *= delta;\n if (countLimit < 1.0)\n {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n }\n\n dir *= strength;\n\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n for (float t = 0.0; t < count; t++) {\n float percent = (t + offset) / count;\n float weight = 4.0 * (percent - percent * percent);\n vec2 p = vTextureCoord + dir * percent;\n vec4 sample = texture2D(uSampler, p);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n sample.rgb *= sample.a;\n\n color += sample * weight;\n total += weight;\n\n if (t > countLimit){\n break;\n }\n }\n\n gl_FragColor = color / total;\n\n // switch back from pre-multiplied alpha\n gl_FragColor.rgb /= gl_FragColor.a + 0.00001;\n}\n",ZoomBlurFilter=function(t){function e(e,n,i,r){void 0===e&&(e=.1),void 0===n&&(n=[0,0]),void 0===i&&(i=0),void 0===r&&(r=1e9),t.call(this,vertex,fragment),this.center=n,this.strength=e,this.innerRadius=i,this.radius=r,this._defaultSize=new Float32Array([0,0]),this._size=new Float32Array([0,0]),this.clearSize()}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={center:{},strength:{},innerRadius:{},radius:{}};return e.prototype.apply=function(t,e,n,i){this._customSize||(this._defaultSize[0]=e.sourceFrame.width,this._defaultSize[1]=e.sourceFrame.height),t.applyFilter(this,e,n,i)},e.prototype.setSize=function(t,e){this._customSize=!0,this._size[0]=t,this._size[1]=e,this.uniforms.uViewSize=this._size},e.prototype.clearSize=function(){this._customSize=!1,this.uniforms.uViewSize=this._defaultSize},n.center.get=function(){return this.uniforms.uCenter},n.center.set=function(t){this.uniforms.uCenter=t},n.strength.get=function(){return this.uniforms.uStrength},n.strength.set=function(t){this.uniforms.uStrength=t},n.innerRadius.get=function(){return this.uniforms.uInnerRadius},n.innerRadius.set=function(t){this.uniforms.uInnerRadius=t},n.radius.get=function(){return this.uniforms.uRadius},n.radius.set=function(t){this.uniforms.uRadius=t},Object.defineProperties(e.prototype,n),e}(PIXI.Filter);PIXI.filters.ZoomBlurFilter=ZoomBlurFilter;export{ZoomBlurFilter};
var vertex="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n",fragment="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform vec2 uCenter;\nuniform float uStrength;\nuniform float uInnerRadius;\nuniform float uRadius;\n\nfloat random(vec3 scale, float seed) {\n // use the fragment position for a different seed per-pixel\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main() {\n\n vec2 center = uCenter.xy / filterArea.xy;\n vec2 dir = vec2(center - vTextureCoord);\n float dist = length(vec2(dir.x, dir.y * filterArea.y / filterArea.x));\n\n float strength = uStrength;\n\n const float count = 32.0;\n float countLimit = count;\n\n float minGradient = uInnerRadius * 0.3;\n float gradient = uRadius * 0.3;\n\n float innerRadius = (uInnerRadius + minGradient * 0.5) / filterArea.x;\n float radius = (uRadius - gradient * 0.5) / filterArea.x;\n\n float delta = 0.0;\n float gap;\n if (dist < innerRadius) {\n delta = innerRadius - dist;\n gap = minGradient;\n } else if (dist > radius) {\n delta = dist - radius;\n gap = gradient;\n }\n\n if (delta > 0.0) {\n float normalCount = gap / filterArea.x;\n delta = (normalCount - delta) / normalCount;\n countLimit *= delta;\n strength *= delta;\n if (countLimit < 1.0)\n {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n }\n\n // randomize the lookup values to hide the fixed number of samples\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n float total = 0.0;\n vec4 color = vec4(0.0);\n\n dir *= strength;\n\n for (float t = 0.0; t < count; t++) {\n float percent = (t + offset) / count;\n float weight = 4.0 * (percent - percent * percent);\n vec2 p = vTextureCoord + dir * percent;\n vec4 sample = texture2D(uSampler, p);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n sample.rgb *= sample.a;\n\n color += sample * weight;\n total += weight;\n\n if (t > countLimit){\n break;\n }\n }\n\n gl_FragColor = color / total;\n\n // switch back from pre-multiplied alpha\n gl_FragColor.rgb /= gl_FragColor.a + 0.00001;\n}\n",ZoomBlurFilter=function(n){function t(t,e,r,i){void 0===t&&(t=.1),void 0===e&&(e=[0,0]),void 0===r&&(r=0),void 0===i&&(i=1e8),n.call(this,vertex,fragment),this.center=e,this.strength=t,this.innerRadius=r,this.radius=i}n&&(t.__proto__=n),(t.prototype=Object.create(n&&n.prototype)).constructor=t;var e={center:{},strength:{},innerRadius:{},radius:{}};return e.center.get=function(){return this.uniforms.uCenter},e.center.set=function(n){this.uniforms.uCenter=n},e.strength.get=function(){return this.uniforms.uStrength},e.strength.set=function(n){this.uniforms.uStrength=n},e.innerRadius.get=function(){return this.uniforms.uInnerRadius},e.innerRadius.set=function(n){this.uniforms.uInnerRadius=n},e.radius.get=function(){return this.uniforms.uRadius},e.radius.set=function(n){this.uniforms.uRadius=n},Object.defineProperties(t.prototype,e),t}(PIXI.Filter);PIXI.filters.ZoomBlurFilter=ZoomBlurFilter;export{ZoomBlurFilter};
//# sourceMappingURL=filter-zoom-blur.es.min.js.map
/*!
* @pixi/filter-zoom-blur - v2.0.2
* Compiled Wed, 11 Oct 2017 19:50:17 UTC
* @pixi/filter-zoom-blur - v2.1.0
* Compiled Thu, 12 Oct 2017 13:21:42 UTC
*

@@ -19,3 +19,3 @@ * pixi-filters is licensed under the MIT License.

var fragment = "varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uViewSize;\nuniform vec2 uCenter;\nuniform float uStrength;\nuniform float uInnerRadius;\nuniform float uRadius;\n\n\nfloat random(vec3 scale, float seed) {\n // use the fragment position for a different seed per-pixel\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main() {\n\n vec2 texCoord = gl_FragCoord.xy / uViewSize.xy;\n texCoord.y = 1.0 - texCoord.y;\n\n vec2 center = uCenter.xy / uViewSize.xy;\n vec2 dir = vec2(center - texCoord);\n\n dir.x *= uViewSize.x / uViewSize.y;\n\n float dist = length(dir);\n\n float strength = uStrength;\n\n // randomize the lookup values to hide the fixed number of samples\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n const float count = 32.0;\n float countLimit = count;\n\n float minGradient = uInnerRadius * 0.3;\n float gradient = uRadius * 0.3;\n\n float innerRadius = (uInnerRadius + minGradient * 0.5) / uViewSize.y;\n float radius = (uRadius - gradient * 0.5) / uViewSize.y;\n\n float delta = 0.0;\n float gap;\n if (dist < innerRadius) {\n delta = innerRadius - dist;\n gap = minGradient;\n } else if (dist > radius) {\n delta = dist - radius;\n gap = gradient;\n }\n\n if (delta > 0.0) {\n float normalCount = gap / uViewSize.y;\n delta = (normalCount - delta) / normalCount;\n countLimit *= delta;\n strength *= delta;\n if (countLimit < 1.0)\n {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n }\n\n dir *= strength;\n\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n for (float t = 0.0; t < count; t++) {\n float percent = (t + offset) / count;\n float weight = 4.0 * (percent - percent * percent);\n vec2 p = vTextureCoord + dir * percent;\n vec4 sample = texture2D(uSampler, p);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n sample.rgb *= sample.a;\n\n color += sample * weight;\n total += weight;\n\n if (t > countLimit){\n break;\n }\n }\n\n gl_FragColor = color / total;\n\n // switch back from pre-multiplied alpha\n gl_FragColor.rgb /= gl_FragColor.a + 0.00001;\n}\n";
var fragment = "varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform vec2 uCenter;\nuniform float uStrength;\nuniform float uInnerRadius;\nuniform float uRadius;\n\nfloat random(vec3 scale, float seed) {\n // use the fragment position for a different seed per-pixel\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main() {\n\n vec2 center = uCenter.xy / filterArea.xy;\n vec2 dir = vec2(center - vTextureCoord);\n float dist = length(vec2(dir.x, dir.y * filterArea.y / filterArea.x));\n\n float strength = uStrength;\n\n const float count = 32.0;\n float countLimit = count;\n\n float minGradient = uInnerRadius * 0.3;\n float gradient = uRadius * 0.3;\n\n float innerRadius = (uInnerRadius + minGradient * 0.5) / filterArea.x;\n float radius = (uRadius - gradient * 0.5) / filterArea.x;\n\n float delta = 0.0;\n float gap;\n if (dist < innerRadius) {\n delta = innerRadius - dist;\n gap = minGradient;\n } else if (dist > radius) {\n delta = dist - radius;\n gap = gradient;\n }\n\n if (delta > 0.0) {\n float normalCount = gap / filterArea.x;\n delta = (normalCount - delta) / normalCount;\n countLimit *= delta;\n strength *= delta;\n if (countLimit < 1.0)\n {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n }\n\n // randomize the lookup values to hide the fixed number of samples\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n float total = 0.0;\n vec4 color = vec4(0.0);\n\n dir *= strength;\n\n for (float t = 0.0; t < count; t++) {\n float percent = (t + offset) / count;\n float weight = 4.0 * (percent - percent * percent);\n vec2 p = vTextureCoord + dir * percent;\n vec4 sample = texture2D(uSampler, p);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n sample.rgb *= sample.a;\n\n color += sample * weight;\n total += weight;\n\n if (t > countLimit){\n break;\n }\n }\n\n gl_FragColor = color / total;\n\n // switch back from pre-multiplied alpha\n gl_FragColor.rgb /= gl_FragColor.a + 0.00001;\n}\n";

@@ -29,6 +29,6 @@ /**

* @memberof PIXI.filters
* @param {number} [strength=2] Sets the strength of the zoom blur effect
* @param {number} [strength=0.1] Sets the strength of the zoom blur effect
* @param {PIXI.Point|number[]} [center=[0,0]] The center of the zoom.
* @param {number} [innerRadius=0] The inner radius of zoom. The part in inner circle won't apply zoom blur effect.
* @param {number} [radius=1E9] Very very large outer radius of the zoom.
* @param {number} [radius=1E8] Outer radius of the zoom, The default value is very very large.
*/

@@ -40,3 +40,3 @@ var ZoomBlurFilter = (function (superclass) {

if ( innerRadius === void 0 ) innerRadius = 0;
if ( radius === void 0 ) radius = 1E9;
if ( radius === void 0 ) radius = 1E8;

@@ -49,6 +49,2 @@ superclass.call(this, vertex, fragment);

this.radius = radius;
this._defaultSize = new Float32Array([0, 0]);
this._size = new Float32Array([0, 0]);
this.clearSize();
}

@@ -63,40 +59,2 @@

/**
* Apply the filter
* @override
* @private
*/
ZoomBlurFilter.prototype.apply = function apply (filterManager, input, output, clear)
{
// Apply the input source if view is not set
if (!this._customSize)
{
this._defaultSize[0] = input.sourceFrame.width;
this._defaultSize[1] = input.sourceFrame.height;
}
filterManager.applyFilter(this, input, output, clear);
};
/**
* Set the view size, if defining a region.
* @method
* @param {number} width - Width of the view size
* @param {number} height - Height of the view size
*/
ZoomBlurFilter.prototype.setSize = function setSize (width, height) {
this._customSize = true;
this._size[0] = width;
this._size[1] = height;
this.uniforms.uViewSize = this._size;
};
/**
* Clear the defined view size of the region to effect.
* @method
*/
ZoomBlurFilter.prototype.clearSize = function clearSize () {
this._customSize = false;
this.uniforms.uViewSize = this._defaultSize;
};
/**
* Center of the effect.

@@ -144,3 +102,3 @@ *

* @member {number}
* @default 1E9
* @default 1E8
*/

@@ -147,0 +105,0 @@ prototypeAccessors.radius.get = function () {

/*!
* @pixi/filter-zoom-blur - v2.0.2
* Compiled Wed, 11 Oct 2017 19:50:17 UTC
* @pixi/filter-zoom-blur - v2.1.0
* Compiled Thu, 12 Oct 2017 13:21:43 UTC
*

@@ -8,3 +8,3 @@ * pixi-filters is licensed under the MIT License.

*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.__filter_zoom_blur={})}(this,function(e){"use strict";var t="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n",n="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uViewSize;\nuniform vec2 uCenter;\nuniform float uStrength;\nuniform float uInnerRadius;\nuniform float uRadius;\n\n\nfloat random(vec3 scale, float seed) {\n // use the fragment position for a different seed per-pixel\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main() {\n\n vec2 texCoord = gl_FragCoord.xy / uViewSize.xy;\n texCoord.y = 1.0 - texCoord.y;\n\n vec2 center = uCenter.xy / uViewSize.xy;\n vec2 dir = vec2(center - texCoord);\n\n dir.x *= uViewSize.x / uViewSize.y;\n\n float dist = length(dir);\n\n float strength = uStrength;\n\n // randomize the lookup values to hide the fixed number of samples\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n const float count = 32.0;\n float countLimit = count;\n\n float minGradient = uInnerRadius * 0.3;\n float gradient = uRadius * 0.3;\n\n float innerRadius = (uInnerRadius + minGradient * 0.5) / uViewSize.y;\n float radius = (uRadius - gradient * 0.5) / uViewSize.y;\n\n float delta = 0.0;\n float gap;\n if (dist < innerRadius) {\n delta = innerRadius - dist;\n gap = minGradient;\n } else if (dist > radius) {\n delta = dist - radius;\n gap = gradient;\n }\n\n if (delta > 0.0) {\n float normalCount = gap / uViewSize.y;\n delta = (normalCount - delta) / normalCount;\n countLimit *= delta;\n strength *= delta;\n if (countLimit < 1.0)\n {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n }\n\n dir *= strength;\n\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n for (float t = 0.0; t < count; t++) {\n float percent = (t + offset) / count;\n float weight = 4.0 * (percent - percent * percent);\n vec2 p = vTextureCoord + dir * percent;\n vec4 sample = texture2D(uSampler, p);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n sample.rgb *= sample.a;\n\n color += sample * weight;\n total += weight;\n\n if (t > countLimit){\n break;\n }\n }\n\n gl_FragColor = color / total;\n\n // switch back from pre-multiplied alpha\n gl_FragColor.rgb /= gl_FragColor.a + 0.00001;\n}\n",i=function(e){function i(i,r,o,u){void 0===i&&(i=.1),void 0===r&&(r=[0,0]),void 0===o&&(o=0),void 0===u&&(u=1e9),e.call(this,t,n),this.center=r,this.strength=i,this.innerRadius=o,this.radius=u,this._defaultSize=new Float32Array([0,0]),this._size=new Float32Array([0,0]),this.clearSize()}e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i;var r={center:{},strength:{},innerRadius:{},radius:{}};return i.prototype.apply=function(e,t,n,i){this._customSize||(this._defaultSize[0]=t.sourceFrame.width,this._defaultSize[1]=t.sourceFrame.height),e.applyFilter(this,t,n,i)},i.prototype.setSize=function(e,t){this._customSize=!0,this._size[0]=e,this._size[1]=t,this.uniforms.uViewSize=this._size},i.prototype.clearSize=function(){this._customSize=!1,this.uniforms.uViewSize=this._defaultSize},r.center.get=function(){return this.uniforms.uCenter},r.center.set=function(e){this.uniforms.uCenter=e},r.strength.get=function(){return this.uniforms.uStrength},r.strength.set=function(e){this.uniforms.uStrength=e},r.innerRadius.get=function(){return this.uniforms.uInnerRadius},r.innerRadius.set=function(e){this.uniforms.uInnerRadius=e},r.radius.get=function(){return this.uniforms.uRadius},r.radius.set=function(e){this.uniforms.uRadius=e},Object.defineProperties(i.prototype,r),i}(PIXI.Filter);PIXI.filters.ZoomBlurFilter=i,e.ZoomBlurFilter=i,Object.defineProperty(e,"__esModule",{value:!0})});
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(n.__filter_zoom_blur={})}(this,function(n){"use strict";var t="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n",e="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform vec2 uCenter;\nuniform float uStrength;\nuniform float uInnerRadius;\nuniform float uRadius;\n\nfloat random(vec3 scale, float seed) {\n // use the fragment position for a different seed per-pixel\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main() {\n\n vec2 center = uCenter.xy / filterArea.xy;\n vec2 dir = vec2(center - vTextureCoord);\n float dist = length(vec2(dir.x, dir.y * filterArea.y / filterArea.x));\n\n float strength = uStrength;\n\n const float count = 32.0;\n float countLimit = count;\n\n float minGradient = uInnerRadius * 0.3;\n float gradient = uRadius * 0.3;\n\n float innerRadius = (uInnerRadius + minGradient * 0.5) / filterArea.x;\n float radius = (uRadius - gradient * 0.5) / filterArea.x;\n\n float delta = 0.0;\n float gap;\n if (dist < innerRadius) {\n delta = innerRadius - dist;\n gap = minGradient;\n } else if (dist > radius) {\n delta = dist - radius;\n gap = gradient;\n }\n\n if (delta > 0.0) {\n float normalCount = gap / filterArea.x;\n delta = (normalCount - delta) / normalCount;\n countLimit *= delta;\n strength *= delta;\n if (countLimit < 1.0)\n {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n }\n\n // randomize the lookup values to hide the fixed number of samples\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n float total = 0.0;\n vec4 color = vec4(0.0);\n\n dir *= strength;\n\n for (float t = 0.0; t < count; t++) {\n float percent = (t + offset) / count;\n float weight = 4.0 * (percent - percent * percent);\n vec2 p = vTextureCoord + dir * percent;\n vec4 sample = texture2D(uSampler, p);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n sample.rgb *= sample.a;\n\n color += sample * weight;\n total += weight;\n\n if (t > countLimit){\n break;\n }\n }\n\n gl_FragColor = color / total;\n\n // switch back from pre-multiplied alpha\n gl_FragColor.rgb /= gl_FragColor.a + 0.00001;\n}\n",r=function(n){function r(r,i,o,a){void 0===r&&(r=.1),void 0===i&&(i=[0,0]),void 0===o&&(o=0),void 0===a&&(a=1e8),n.call(this,t,e),this.center=i,this.strength=r,this.innerRadius=o,this.radius=a}n&&(r.__proto__=n),(r.prototype=Object.create(n&&n.prototype)).constructor=r;var i={center:{},strength:{},innerRadius:{},radius:{}};return i.center.get=function(){return this.uniforms.uCenter},i.center.set=function(n){this.uniforms.uCenter=n},i.strength.get=function(){return this.uniforms.uStrength},i.strength.set=function(n){this.uniforms.uStrength=n},i.innerRadius.get=function(){return this.uniforms.uInnerRadius},i.innerRadius.set=function(n){this.uniforms.uInnerRadius=n},i.radius.get=function(){return this.uniforms.uRadius},i.radius.set=function(n){this.uniforms.uRadius=n},Object.defineProperties(r.prototype,i),r}(PIXI.Filter);PIXI.filters.ZoomBlurFilter=r,n.ZoomBlurFilter=r,Object.defineProperty(n,"__esModule",{value:!0})});
//# sourceMappingURL=filter-zoom-blur.min.js.map
{
"name": "@pixi/filter-zoom-blur",
"version": "2.1.0",
"version": "2.1.1",
"main": "lib/filter-zoom-blur.min.js",

@@ -5,0 +5,0 @@ "description": "Zoom Blur filter",

@@ -9,4 +9,2 @@ /// <reference types="pixi.js" />

radius:number;
setSize(width:number, height:number):void;
clearSize():void;
}

@@ -13,0 +11,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc