Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pixi/filter-shockwave

Package Overview
Dependencies
Maintainers
3
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/filter-shockwave - npm Package Compare versions

Comparing version 2.2.0 to 2.3.0

103

lib/filter-shockwave.es.js
/*!
* @pixi/filter-shockwave - v2.2.0
* Compiled Wed, 18 Oct 2017 20:55:19 UTC
* @pixi/filter-shockwave - v2.3.0
* Compiled Tue, 31 Oct 2017 18:03:29 UTC
*

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

*/
if (typeof PIXI === 'undefined' || typeof PIXI.filters === 'undefined') { throw 'PixiJS is required'; }
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}";
var fragment = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nuniform vec2 center;\nuniform vec3 params; // 10.0, 0.8, 0.1\nuniform float time;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nvoid main()\n{\n vec2 uv = vTextureCoord * filterArea.xy / dimensions.xy;\n vec2 coord = uv;\n\n float dist = distance(coord, center);\n\n if ( (dist <= (time + params.z)) && (dist >= (time - params.z)) )\n {\n float diff = (dist - time);\n float powDiff = 1.0 - pow(abs(diff*params.x), params.y);\n\n float diffTime = diff * powDiff;\n vec2 diffUV = normalize(uv - center);\n coord = uv + (diffUV * diffTime);\n }\n\n coord *= dimensions.xy / filterArea.xy;\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n gl_FragColor = texture2D(uSampler, clampedCoord);\n if (coord != clampedCoord) {\n gl_FragColor *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n}\n";
/**
* The ColorMatrixFilter class lets you apply a 4x4 matrix transformation on the RGBA
* color and alpha values of every pixel on your displayObject to produce a result
* with a new set of RGBA color and alpha values. It's pretty powerful!
* ![original](../tools/screenshots/dist/original.png)![filter](../tools/screenshots/dist/shockwave.gif)
*
* @class
* @extends PIXI.Filter
* @memberof PIXI.filters
* @param {PIXI.Point} [center=[0.5, 0.5]] See center property
* @param {Array<number>} [params=[10, 0.8, 0.1]] See params property
* @param {number} [time=0] See time property
*/
var ShockwaveFilter = (function (superclass) {
function ShockwaveFilter(center, params, time) {
if ( center === void 0 ) center = [0.5, 0.5];
if ( params === void 0 ) params = [10, 0.8, 0.1];
if ( time === void 0 ) time = 0;
superclass.call(this, vertex, fragment, {
center: { type: 'v2', value: { x: 0.5, y: 0.5 } },
params: { type: 'v3', value: { x: 10, y: 0.8, z: 0.1 } },
time: { type: '1f', value: 0 },
dimensions: { type: '2f', value: [0, 0] }
});
this.center = center;
this.params = params;
this.time = time;
}
if ( superclass ) ShockwaveFilter.__proto__ = superclass;
ShockwaveFilter.prototype = Object.create( superclass && superclass.prototype );
ShockwaveFilter.prototype.constructor = ShockwaveFilter;
var prototypeAccessors = { center: {},params: {},time: {} };
ShockwaveFilter.prototype.apply = function apply (filterManager, input, output) {
this.uniforms.dimensions[0] = input.sourceFrame.width;
this.uniforms.dimensions[1] = input.sourceFrame.height;
filterManager.applyFilter(this, input, output);
};
/**
* Sets the center of the shockwave in normalized screen coords. That is
* (0,0) is the top-left and (1,1) is the bottom right.
*
* @member {PIXI.Point}
*/
prototypeAccessors.center.get = function () {
return this.uniforms.center;
};
prototypeAccessors.center.set = function (value) {
this.uniforms.center = value;
};
/**
* Sets the params of the shockwave. These modify the look and behavior of
* the shockwave as it ripples out.
*
* @member {Array<number>}
*/
prototypeAccessors.params.get = function () {
return this.uniforms.params;
};
prototypeAccessors.params.set = function (value) {
this.uniforms.params = value;
};
/**
* Sets the elapsed time of the shockwave. This controls the speed at which
* the shockwave ripples out.
*
* @member {number}
*/
prototypeAccessors.time.get = function () {
return this.uniforms.time;
};
prototypeAccessors.time.set = function (value) {
this.uniforms.time = value;
};
Object.defineProperties( ShockwaveFilter.prototype, prototypeAccessors );
return ShockwaveFilter;
}(PIXI.Filter));
// Export to PixiJS namespace
PIXI.filters.ShockwaveFilter = ShockwaveFilter;
export { ShockwaveFilter };
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}",fragment="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\n\nuniform vec2 center;\n\nuniform float amplitude;\nuniform float wavelength;\n// uniform float power;\nuniform float brightness;\nuniform float speed;\nuniform float radius;\n\nuniform float time;\n\nconst float PI = 3.14159;\n\nvoid main()\n{\n float halfWavelength = wavelength * 0.5 / filterArea.x;\n float maxRadius = radius / filterArea.x;\n float currentRadius = time * speed / filterArea.x;\n\n float fade = 1.0;\n\n if (maxRadius > 0.0) {\n if (currentRadius > maxRadius) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n fade = 1.0 - pow(currentRadius / maxRadius, 2.0);\n }\n\n vec2 dir = vec2(vTextureCoord - center / filterArea.xy);\n dir.y *= filterArea.y / filterArea.x;\n float dist = length(dir);\n\n if (dist <= 0.0 || dist < currentRadius - halfWavelength || dist > currentRadius + halfWavelength) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n\n vec2 diffUV = normalize(dir);\n\n float diff = (dist - currentRadius) / halfWavelength;\n\n float p = 1.0 - pow(abs(diff), 2.0);\n\n // float powDiff = diff * pow(p, 2.0) * ( amplitude * fade );\n float powDiff = 1.25 * sin(diff * PI) * p * ( amplitude * fade );\n\n vec2 offset = diffUV * powDiff / filterArea.xy;\n\n // Do clamp :\n vec2 coord = vTextureCoord + offset;\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n gl_FragColor = texture2D(uSampler, clampedCoord);\n if (coord != clampedCoord) {\n gl_FragColor *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n // No clamp :\n // gl_FragColor = texture2D(uSampler, vTextureCoord + offset);\n\n gl_FragColor.rgb *= 1.0 + (brightness - 1.0) * p * fade;\n}\n",ShockwaveFilter=function(e){function t(t,n,r){void 0===t&&(t=[0,0]),void 0===n&&(n={}),void 0===r&&(r=0),e.call(this,vertex,fragment),this.center=t,Array.isArray(n)&&(console.warn("Deprecated Warning: ShockwaveFilter params Array has been changed to options Object."),n={}),n=Object.assign({amplitude:30,wavelength:160,brightness:1,speed:500,radius:-1},n),this.amplitude=n.amplitude,this.wavelength=n.wavelength,this.brightness=n.brightness,this.speed=n.speed,this.radius=n.radius,this.time=r}e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t;var n={center:{configurable:!0},amplitude:{configurable:!0},wavelength:{configurable:!0},brightness:{configurable:!0},speed:{configurable:!0},radius:{configurable:!0}};return t.prototype.apply=function(e,t,n){this.uniforms.time=this.time,e.applyFilter(this,t,n)},n.center.get=function(){return this.uniforms.center},n.center.set=function(e){this.uniforms.center=e},n.amplitude.get=function(){return this.uniforms.amplitude},n.amplitude.set=function(e){this.uniforms.amplitude=e},n.wavelength.get=function(){return this.uniforms.wavelength},n.wavelength.set=function(e){this.uniforms.wavelength=e},n.brightness.get=function(){return this.uniforms.brightness},n.brightness.set=function(e){this.uniforms.brightness=e},n.speed.get=function(){return this.uniforms.speed},n.speed.set=function(e){this.uniforms.speed=e},n.radius.get=function(){return this.uniforms.radius},n.radius.set=function(e){this.uniforms.radius=e},Object.defineProperties(t.prototype,n),t}(PIXI.Filter);PIXI.filters.ShockwaveFilter=ShockwaveFilter;export{ShockwaveFilter};
//# sourceMappingURL=filter-shockwave.es.js.map
/*!
* @pixi/filter-shockwave - v2.2.0
* Compiled Wed, 18 Oct 2017 20:55:18 UTC
* @pixi/filter-shockwave - v2.3.0
* Compiled Tue, 31 Oct 2017 18:03:29 UTC
*

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

*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.__filter_shockwave = {})));
}(this, (function (exports) { 'use strict';
if (typeof PIXI === 'undefined' || typeof PIXI.filters === 'undefined') { throw 'PixiJS is required'; }
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}";
var fragment = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nuniform vec2 center;\nuniform vec3 params; // 10.0, 0.8, 0.1\nuniform float time;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nvoid main()\n{\n vec2 uv = vTextureCoord * filterArea.xy / dimensions.xy;\n vec2 coord = uv;\n\n float dist = distance(coord, center);\n\n if ( (dist <= (time + params.z)) && (dist >= (time - params.z)) )\n {\n float diff = (dist - time);\n float powDiff = 1.0 - pow(abs(diff*params.x), params.y);\n\n float diffTime = diff * powDiff;\n vec2 diffUV = normalize(uv - center);\n coord = uv + (diffUV * diffTime);\n }\n\n coord *= dimensions.xy / filterArea.xy;\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n gl_FragColor = texture2D(uSampler, clampedCoord);\n if (coord != clampedCoord) {\n gl_FragColor *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n}\n";
/**
* The ColorMatrixFilter class lets you apply a 4x4 matrix transformation on the RGBA
* color and alpha values of every pixel on your displayObject to produce a result
* with a new set of RGBA color and alpha values. It's pretty powerful!
* ![original](../tools/screenshots/dist/original.png)![filter](../tools/screenshots/dist/shockwave.gif)
*
* @class
* @extends PIXI.Filter
* @memberof PIXI.filters
* @param {PIXI.Point} [center=[0.5, 0.5]] See center property
* @param {Array<number>} [params=[10, 0.8, 0.1]] See params property
* @param {number} [time=0] See time property
*/
var ShockwaveFilter = (function (superclass) {
function ShockwaveFilter(center, params, time) {
if ( center === void 0 ) center = [0.5, 0.5];
if ( params === void 0 ) params = [10, 0.8, 0.1];
if ( time === void 0 ) time = 0;
superclass.call(this, vertex, fragment, {
center: { type: 'v2', value: { x: 0.5, y: 0.5 } },
params: { type: 'v3', value: { x: 10, y: 0.8, z: 0.1 } },
time: { type: '1f', value: 0 },
dimensions: { type: '2f', value: [0, 0] }
});
this.center = center;
this.params = params;
this.time = time;
}
if ( superclass ) ShockwaveFilter.__proto__ = superclass;
ShockwaveFilter.prototype = Object.create( superclass && superclass.prototype );
ShockwaveFilter.prototype.constructor = ShockwaveFilter;
var prototypeAccessors = { center: {},params: {},time: {} };
ShockwaveFilter.prototype.apply = function apply (filterManager, input, output) {
this.uniforms.dimensions[0] = input.sourceFrame.width;
this.uniforms.dimensions[1] = input.sourceFrame.height;
filterManager.applyFilter(this, input, output);
};
/**
* Sets the center of the shockwave in normalized screen coords. That is
* (0,0) is the top-left and (1,1) is the bottom right.
*
* @member {PIXI.Point}
*/
prototypeAccessors.center.get = function () {
return this.uniforms.center;
};
prototypeAccessors.center.set = function (value) {
this.uniforms.center = value;
};
/**
* Sets the params of the shockwave. These modify the look and behavior of
* the shockwave as it ripples out.
*
* @member {Array<number>}
*/
prototypeAccessors.params.get = function () {
return this.uniforms.params;
};
prototypeAccessors.params.set = function (value) {
this.uniforms.params = value;
};
/**
* Sets the elapsed time of the shockwave. This controls the speed at which
* the shockwave ripples out.
*
* @member {number}
*/
prototypeAccessors.time.get = function () {
return this.uniforms.time;
};
prototypeAccessors.time.set = function (value) {
this.uniforms.time = value;
};
Object.defineProperties( ShockwaveFilter.prototype, prototypeAccessors );
return ShockwaveFilter;
}(PIXI.Filter));
// Export to PixiJS namespace
PIXI.filters.ShockwaveFilter = ShockwaveFilter;
exports.ShockwaveFilter = ShockwaveFilter;
Object.defineProperty(exports, '__esModule', { value: true });
})));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.__filter_shockwave={})}(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="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\n\nuniform vec2 center;\n\nuniform float amplitude;\nuniform float wavelength;\n// uniform float power;\nuniform float brightness;\nuniform float speed;\nuniform float radius;\n\nuniform float time;\n\nconst float PI = 3.14159;\n\nvoid main()\n{\n float halfWavelength = wavelength * 0.5 / filterArea.x;\n float maxRadius = radius / filterArea.x;\n float currentRadius = time * speed / filterArea.x;\n\n float fade = 1.0;\n\n if (maxRadius > 0.0) {\n if (currentRadius > maxRadius) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n fade = 1.0 - pow(currentRadius / maxRadius, 2.0);\n }\n\n vec2 dir = vec2(vTextureCoord - center / filterArea.xy);\n dir.y *= filterArea.y / filterArea.x;\n float dist = length(dir);\n\n if (dist <= 0.0 || dist < currentRadius - halfWavelength || dist > currentRadius + halfWavelength) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n\n vec2 diffUV = normalize(dir);\n\n float diff = (dist - currentRadius) / halfWavelength;\n\n float p = 1.0 - pow(abs(diff), 2.0);\n\n // float powDiff = diff * pow(p, 2.0) * ( amplitude * fade );\n float powDiff = 1.25 * sin(diff * PI) * p * ( amplitude * fade );\n\n vec2 offset = diffUV * powDiff / filterArea.xy;\n\n // Do clamp :\n vec2 coord = vTextureCoord + offset;\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n gl_FragColor = texture2D(uSampler, clampedCoord);\n if (coord != clampedCoord) {\n gl_FragColor *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n // No clamp :\n // gl_FragColor = texture2D(uSampler, vTextureCoord + offset);\n\n gl_FragColor.rgb *= 1.0 + (brightness - 1.0) * p * fade;\n}\n",r=function(e){function r(r,i,o){void 0===r&&(r=[0,0]),void 0===i&&(i={}),void 0===o&&(o=0),e.call(this,t,n),this.center=r,Array.isArray(i)&&(console.warn("Deprecated Warning: ShockwaveFilter params Array has been changed to options Object."),i={}),i=Object.assign({amplitude:30,wavelength:160,brightness:1,speed:500,radius:-1},i),this.amplitude=i.amplitude,this.wavelength=i.wavelength,this.brightness=i.brightness,this.speed=i.speed,this.radius=i.radius,this.time=o}e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r;var i={center:{configurable:!0},amplitude:{configurable:!0},wavelength:{configurable:!0},brightness:{configurable:!0},speed:{configurable:!0},radius:{configurable:!0}};return r.prototype.apply=function(e,t,n){this.uniforms.time=this.time,e.applyFilter(this,t,n)},i.center.get=function(){return this.uniforms.center},i.center.set=function(e){this.uniforms.center=e},i.amplitude.get=function(){return this.uniforms.amplitude},i.amplitude.set=function(e){this.uniforms.amplitude=e},i.wavelength.get=function(){return this.uniforms.wavelength},i.wavelength.set=function(e){this.uniforms.wavelength=e},i.brightness.get=function(){return this.uniforms.brightness},i.brightness.set=function(e){this.uniforms.brightness=e},i.speed.get=function(){return this.uniforms.speed},i.speed.set=function(e){this.uniforms.speed=e},i.radius.get=function(){return this.uniforms.radius},i.radius.set=function(e){this.uniforms.radius=e},Object.defineProperties(r.prototype,i),r}(PIXI.Filter);PIXI.filters.ShockwaveFilter=r,e.ShockwaveFilter=r,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=filter-shockwave.js.map

17

package.json
{
"name": "@pixi/filter-shockwave",
"version": "2.2.0",
"main": "lib/filter-shockwave.min.js",
"version": "2.3.0",
"main": "lib/filter-shockwave.js",
"description": "Display filter render as ASCII text",

@@ -10,3 +10,3 @@ "author": "Mat Groves",

],
"module": "lib/filter-shockwave.es.min.js",
"module": "lib/filter-shockwave.es.js",
"types": "types.d.ts",

@@ -24,5 +24,5 @@ "homepage": "http://pixijs.com/",

"scripts": {
"build:umd": "rollup -c -f umd && rollup -cp -f umd",
"build:es": "rollup -c && rollup -cp",
"build": "npm run build:umd && npm run build:es",
"build:dev": "rollup -c && rollup -c -f umd",
"build": "rollup -cp && rollup -cp -f umd",
"watch": "rollup -cw",
"postversion": "npm run build"

@@ -38,6 +38,7 @@ },

"devDependencies": {
"@tools/build": "^2.0.1",
"@tools/build": "^2.3.0",
"@tools/fragments": "^2.0.0",
"rollup": "^0.45.2"
"rollup": "^0.45.2",
"rollup-watch": "^4.3.1"
}
}
/// <reference types="pixi.js" />
declare namespace PIXI.filters {
class ShockwaveFilter extends PIXI.Filter {
constructor(center?:PIXI.Point, params?:number[], time?:number);
center:PIXI.Point;
params:number[];
time:number;
class ShockwaveFilter extends PIXI.Filter<{}> {
constructor(center?:PIXI.Point|number[], options?:ShockwaveOptions, time?:number);
center: PIXI.Point|number[];
options: ShockwaveOptions;
time: number;
}
interface ShockwaveOptions {
amplitude?: number;
wavelength?: number;
brightness?: number;
speed?: number;
radius?: number;
}
}

@@ -10,0 +17,0 @@

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