@pixi/filter-noise
Advanced tools
Comparing version 6.5.3 to 7.0.0-alpha
/*! | ||
* @pixi/filter-noise - v6.5.3 | ||
* Compiled Fri, 09 Sep 2022 13:55:20 UTC | ||
* @pixi/filter-noise - v7.0.0-alpha | ||
* Compiled Fri, 09 Sep 2022 16:09:18 UTC | ||
* | ||
@@ -14,86 +14,28 @@ * @pixi/filter-noise is licensed under the MIT License. | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
/* global Reflect, Promise */ | ||
var extendStatics = function(d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; | ||
return extendStatics(d, b); | ||
}; | ||
function __extends(d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
} | ||
var fragment = "precision highp float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float uNoise;\nuniform float uSeed;\nuniform sampler2D uSampler;\n\nfloat rand(vec2 co)\n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float randomValue = rand(gl_FragCoord.xy * uSeed);\n float diff = (randomValue - 0.5) * uNoise;\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (color.a > 0.0) {\n color.rgb /= color.a;\n }\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n // Premultiply alpha again.\n color.rgb *= color.a;\n\n gl_FragColor = color;\n}\n"; | ||
/** | ||
* A Noise effect filter. | ||
* | ||
* original filter: https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/noise.js | ||
* @memberof PIXI.filters | ||
* @author Vico @vicocotea | ||
*/ | ||
var NoiseFilter = /** @class */ (function (_super) { | ||
__extends(NoiseFilter, _super); | ||
/** | ||
* @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. | ||
* @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. | ||
*/ | ||
function NoiseFilter(noise, seed) { | ||
if (noise === void 0) { noise = 0.5; } | ||
if (seed === void 0) { seed = Math.random(); } | ||
var _this = _super.call(this, core.defaultFilterVertex, fragment, { | ||
uNoise: 0, | ||
uSeed: 0, | ||
}) || this; | ||
_this.noise = noise; | ||
_this.seed = seed; | ||
return _this; | ||
} | ||
Object.defineProperty(NoiseFilter.prototype, "noise", { | ||
/** | ||
* The amount of noise to apply, this value should be in the range (0, 1]. | ||
* @default 0.5 | ||
*/ | ||
get: function () { | ||
return this.uniforms.uNoise; | ||
}, | ||
set: function (value) { | ||
this.uniforms.uNoise = value; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
class NoiseFilter extends core.Filter { | ||
constructor(noise = 0.5, seed = Math.random()) { | ||
super(core.defaultFilterVertex, fragment, { | ||
uNoise: 0, | ||
uSeed: 0 | ||
}); | ||
Object.defineProperty(NoiseFilter.prototype, "seed", { | ||
/** A seed value to apply to the random noise generation. `Math.random()` is a good value to use. */ | ||
get: function () { | ||
return this.uniforms.uSeed; | ||
}, | ||
set: function (value) { | ||
this.uniforms.uSeed = value; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
return NoiseFilter; | ||
}(core.Filter)); | ||
this.noise = noise; | ||
this.seed = seed; | ||
} | ||
get noise() { | ||
return this.uniforms.uNoise; | ||
} | ||
set noise(value) { | ||
this.uniforms.uNoise = value; | ||
} | ||
get seed() { | ||
return this.uniforms.uSeed; | ||
} | ||
set seed(value) { | ||
this.uniforms.uSeed = value; | ||
} | ||
} | ||
exports.NoiseFilter = NoiseFilter; | ||
//# sourceMappingURL=filter-noise.js.map |
@@ -1,9 +0,42 @@ | ||
/*! | ||
* @pixi/filter-noise - v6.5.3 | ||
* Compiled Fri, 09 Sep 2022 13:55:20 UTC | ||
"use strict";/*! | ||
* @pixi/filter-noise - v7.0.0-alpha | ||
* Compiled Fri, 09 Sep 2022 16:09:18 UTC | ||
* | ||
* @pixi/filter-noise is licensed under the MIT License. | ||
* http://www.opensource.org/licenses/mit-license | ||
*/ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@pixi/core"),o=function(e,r){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,o){e.__proto__=o}||function(e,o){for(var r in o)o.hasOwnProperty(r)&&(e[r]=o[r])},o(e,r)};var r=function(r){function n(o,n){void 0===o&&(o=.5),void 0===n&&(n=Math.random());var t=r.call(this,e.defaultFilterVertex,"precision highp float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float uNoise;\nuniform float uSeed;\nuniform sampler2D uSampler;\n\nfloat rand(vec2 co)\n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float randomValue = rand(gl_FragCoord.xy * uSeed);\n float diff = (randomValue - 0.5) * uNoise;\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (color.a > 0.0) {\n color.rgb /= color.a;\n }\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n // Premultiply alpha again.\n color.rgb *= color.a;\n\n gl_FragColor = color;\n}\n",{uNoise:0,uSeed:0})||this;return t.noise=o,t.seed=n,t}return function(e,r){function n(){this.constructor=e}o(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}(n,r),Object.defineProperty(n.prototype,"noise",{get:function(){return this.uniforms.uNoise},set:function(e){this.uniforms.uNoise=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"seed",{get:function(){return this.uniforms.uSeed},set:function(e){this.uniforms.uSeed=e},enumerable:!1,configurable:!0}),n}(e.Filter);exports.NoiseFilter=r; | ||
*/Object.defineProperty(exports,"__esModule",{value:!0});var r=require("@pixi/core"),n=`precision highp float; | ||
varying vec2 vTextureCoord; | ||
varying vec4 vColor; | ||
uniform float uNoise; | ||
uniform float uSeed; | ||
uniform sampler2D uSampler; | ||
float rand(vec2 co) | ||
{ | ||
return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); | ||
} | ||
void main() | ||
{ | ||
vec4 color = texture2D(uSampler, vTextureCoord); | ||
float randomValue = rand(gl_FragCoord.xy * uSeed); | ||
float diff = (randomValue - 0.5) * uNoise; | ||
// Un-premultiply alpha before applying the color matrix. See issue #3539. | ||
if (color.a > 0.0) { | ||
color.rgb /= color.a; | ||
} | ||
color.r += diff; | ||
color.g += diff; | ||
color.b += diff; | ||
// Premultiply alpha again. | ||
color.rgb *= color.a; | ||
gl_FragColor = color; | ||
} | ||
`;class i extends r.Filter{constructor(e=.5,o=Math.random()){super(r.defaultFilterVertex,n,{uNoise:0,uSeed:0}),this.noise=e,this.seed=o}get noise(){return this.uniforms.uNoise}set noise(e){this.uniforms.uNoise=e}get seed(){return this.uniforms.uSeed}set seed(e){this.uniforms.uSeed=e}}exports.NoiseFilter=i; | ||
//# sourceMappingURL=filter-noise.min.js.map |
{ | ||
"name": "@pixi/filter-noise", | ||
"version": "6.5.3", | ||
"version": "7.0.0-alpha", | ||
"main": "dist/cjs/filter-noise.js", | ||
"module": "dist/esm/filter-noise.mjs", | ||
"bundle": "dist/browser/filter-noise.js", | ||
"types": "index.d.ts", | ||
@@ -20,3 +19,2 @@ "exports": { | ||
}, | ||
"namespace": "PIXI.filters", | ||
"description": "Filter that applies noise to a display object", | ||
@@ -38,10 +36,9 @@ "author": "Mat Groves", | ||
"files": [ | ||
"lib", | ||
"dist", | ||
"*.d.ts" | ||
], | ||
"peerDependencies": { | ||
"@pixi/core": "6.5.3" | ||
}, | ||
"gitHead": "28e6b2841a65837a5e2873a3d5a9c27cabbe795a" | ||
"pixiRequirements": [ | ||
"@pixi/core" | ||
], | ||
"gitHead": "da993226df64b804a9c00ed9ee4d011191467b8a" | ||
} |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
0
17131
12
167
1