@pixi/filter-crt
Advanced tools
Comparing version 3.2.0 to 4.0.0
/*! | ||
* @pixi/filter-crt - v3.2.0 | ||
* Compiled Wed, 23 Dec 2020 00:29:02 UTC | ||
* @pixi/filter-crt - v4.0.0 | ||
* Compiled Wed, 03 Mar 2021 00:14:06 UTC | ||
* | ||
@@ -8,3 +8,3 @@ * @pixi/filter-crt is licensed under the MIT License. | ||
*/ | ||
var __filters=function(n,i){"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}",e="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec2 dimensions;\n\nconst float SQRT_2 = 1.414213;\n\nconst float light = 1.0;\n\nuniform float curvature;\nuniform float lineWidth;\nuniform float lineContrast;\nuniform bool verticalLine;\nuniform float noise;\nuniform float noiseSize;\n\nuniform float vignetting;\nuniform float vignettingAlpha;\nuniform float vignettingBlur;\n\nuniform float seed;\nuniform float time;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n vec2 dir = vec2(vTextureCoord.xy - vec2(0.5, 0.5)) * filterArea.xy / dimensions;\n\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n vec3 rgb = gl_FragColor.rgb;\n\n if (noise > 0.0 && noiseSize > 0.0)\n {\n pixelCoord.x = floor(pixelCoord.x / noiseSize);\n pixelCoord.y = floor(pixelCoord.y / noiseSize);\n float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\n rgb += _noise * noise;\n }\n\n if (lineWidth > 0.0)\n {\n float _c = curvature > 0. ? curvature : 1.;\n float k = curvature > 0. ?(length(dir * dir) * 0.25 * _c * _c + 0.935 * _c) : 1.;\n vec2 uv = dir * k;\n\n float v = (verticalLine ? uv.x * dimensions.x : uv.y * dimensions.y) * min(1.0, 2.0 / lineWidth ) / _c;\n float j = 1. + cos(v * 1.2 - time) * 0.5 * lineContrast;\n rgb *= j;\n float segment = verticalLine ? mod((dir.x + .5) * dimensions.x, 4.) : mod((dir.y + .5) * dimensions.y, 4.);\n rgb *= 0.99 + ceil(segment) * 0.015;\n }\n\n if (vignetting > 0.0)\n {\n float outter = SQRT_2 - vignetting * SQRT_2;\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\n rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\n }\n\n gl_FragColor.rgb = rgb;\n}\n",r=function(n){function i(i){n.call(this,t,e),this.uniforms.dimensions=new Float32Array(2),this.time=0,this.seed=0,Object.assign(this,{curvature:1,lineWidth:1,lineContrast:.25,verticalLine:!1,noise:0,noiseSize:1,seed:0,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3,time:0},i)}n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i;var r={curvature:{configurable:!0},lineWidth:{configurable:!0},lineContrast:{configurable:!0},verticalLine:{configurable:!0},noise:{configurable:!0},noiseSize:{configurable:!0},vignetting:{configurable:!0},vignettingAlpha:{configurable:!0},vignettingBlur:{configurable:!0}};return i.prototype.apply=function(n,i,t,e){this.uniforms.dimensions[0]=i.filterFrame.width,this.uniforms.dimensions[1]=i.filterFrame.height,this.uniforms.seed=this.seed,this.uniforms.time=this.time,n.applyFilter(this,i,t,e)},r.curvature.set=function(n){this.uniforms.curvature=n},r.curvature.get=function(){return this.uniforms.curvature},r.lineWidth.set=function(n){this.uniforms.lineWidth=n},r.lineWidth.get=function(){return this.uniforms.lineWidth},r.lineContrast.set=function(n){this.uniforms.lineContrast=n},r.lineContrast.get=function(){return this.uniforms.lineContrast},r.verticalLine.set=function(n){this.uniforms.verticalLine=n},r.verticalLine.get=function(){return this.uniforms.verticalLine},r.noise.set=function(n){this.uniforms.noise=n},r.noise.get=function(){return this.uniforms.noise},r.noiseSize.set=function(n){this.uniforms.noiseSize=n},r.noiseSize.get=function(){return this.uniforms.noiseSize},r.vignetting.set=function(n){this.uniforms.vignetting=n},r.vignetting.get=function(){return this.uniforms.vignetting},r.vignettingAlpha.set=function(n){this.uniforms.vignettingAlpha=n},r.vignettingAlpha.get=function(){return this.uniforms.vignettingAlpha},r.vignettingBlur.set=function(n){this.uniforms.vignettingBlur=n},r.vignettingBlur.get=function(){return this.uniforms.vignettingBlur},Object.defineProperties(i.prototype,r),i}(i.Filter);return n.CRTFilter=r,n}({},PIXI);Object.assign(PIXI.filters,__filters); | ||
var __filters=function(n,e){"use strict";var t=function(n,e){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(n,e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])})(n,e)};Object.create;Object.create;var i=function(n){function e(t){var i=n.call(this,"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}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec2 dimensions;\n\nconst float SQRT_2 = 1.414213;\n\nconst float light = 1.0;\n\nuniform float curvature;\nuniform float lineWidth;\nuniform float lineContrast;\nuniform bool verticalLine;\nuniform float noise;\nuniform float noiseSize;\n\nuniform float vignetting;\nuniform float vignettingAlpha;\nuniform float vignettingBlur;\n\nuniform float seed;\nuniform float time;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n vec2 dir = vec2(vTextureCoord.xy - vec2(0.5, 0.5)) * filterArea.xy / dimensions;\n\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n vec3 rgb = gl_FragColor.rgb;\n\n if (noise > 0.0 && noiseSize > 0.0)\n {\n pixelCoord.x = floor(pixelCoord.x / noiseSize);\n pixelCoord.y = floor(pixelCoord.y / noiseSize);\n float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\n rgb += _noise * noise;\n }\n\n if (lineWidth > 0.0)\n {\n float _c = curvature > 0. ? curvature : 1.;\n float k = curvature > 0. ?(length(dir * dir) * 0.25 * _c * _c + 0.935 * _c) : 1.;\n vec2 uv = dir * k;\n\n float v = (verticalLine ? uv.x * dimensions.x : uv.y * dimensions.y) * min(1.0, 2.0 / lineWidth ) / _c;\n float j = 1. + cos(v * 1.2 - time) * 0.5 * lineContrast;\n rgb *= j;\n float segment = verticalLine ? mod((dir.x + .5) * dimensions.x, 4.) : mod((dir.y + .5) * dimensions.y, 4.);\n rgb *= 0.99 + ceil(segment) * 0.015;\n }\n\n if (vignetting > 0.0)\n {\n float outter = SQRT_2 - vignetting * SQRT_2;\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\n rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\n }\n\n gl_FragColor.rgb = rgb;\n}\n")||this;return i.time=0,i.seed=0,i.uniforms.dimensions=new Float32Array(2),Object.assign(i,e.defaults,t),i}return function(n,e){function i(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(e,n),e.prototype.apply=function(n,e,t,i){var r=e.filterFrame,o=r.width,u=r.height;this.uniforms.dimensions[0]=o,this.uniforms.dimensions[1]=u,this.uniforms.seed=this.seed,this.uniforms.time=this.time,n.applyFilter(this,e,t,i)},Object.defineProperty(e.prototype,"curvature",{get:function(){return this.uniforms.curvature},set:function(n){this.uniforms.curvature=n},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineWidth",{get:function(){return this.uniforms.lineWidth},set:function(n){this.uniforms.lineWidth=n},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineContrast",{get:function(){return this.uniforms.lineContrast},set:function(n){this.uniforms.lineContrast=n},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticalLine",{get:function(){return this.uniforms.verticalLine},set:function(n){this.uniforms.verticalLine=n},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"noise",{get:function(){return this.uniforms.noise},set:function(n){this.uniforms.noise=n},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"noiseSize",{get:function(){return this.uniforms.noiseSize},set:function(n){this.uniforms.noiseSize=n},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignetting",{get:function(){return this.uniforms.vignetting},set:function(n){this.uniforms.vignetting=n},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignettingAlpha",{get:function(){return this.uniforms.vignettingAlpha},set:function(n){this.uniforms.vignettingAlpha=n},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignettingBlur",{get:function(){return this.uniforms.vignettingBlur},set:function(n){this.uniforms.vignettingBlur=n},enumerable:!1,configurable:!0}),e.defaults={curvature:1,lineWidth:1,lineContrast:.25,verticalLine:!1,noise:0,noiseSize:1,seed:0,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3,time:0},e}(e.Filter);return n.CRTFilter=i,Object.defineProperty(n,"__esModule",{value:!0}),n}({},PIXI);Object.assign(PIXI.filters,__filters); | ||
//# sourceMappingURL=filter-crt.js.map |
{ | ||
"name": "@pixi/filter-crt", | ||
"version": "3.2.0", | ||
"main": "lib/filter-crt.cjs.js", | ||
"version": "4.0.0", | ||
"main": "dist/filter-crt.cjs.js", | ||
"bundle": "dist/filter-crt.js", | ||
"description": "PixiJS filter to apply an effect resembling old CRT monitors", | ||
"author": "finscn <finscn@gmail.com>", | ||
"module": "lib/filter-crt.esm.js", | ||
"types": "types.d.ts", | ||
"module": "dist/filter-crt.esm.js", | ||
"types": "index.d.ts", | ||
"homepage": "http://pixijs.com/", | ||
@@ -21,13 +21,17 @@ "bugs": "https://github.com/pixijs/pixi-filters/issues", | ||
"files": [ | ||
"lib", | ||
"dist", | ||
"types.d.ts" | ||
"index.d.ts" | ||
], | ||
"peerDependencies": { | ||
"@pixi/core": "^5.0.0" | ||
"@pixi/constants": "^6.0.0", | ||
"@pixi/core": "^6.0.0", | ||
"@pixi/math": "^6.0.0" | ||
}, | ||
"devDependencies": { | ||
"@tools/fragments": "^3.0.3" | ||
"@pixi/constants": "^6.0.0", | ||
"@pixi/core": "^6.0.0", | ||
"@pixi/math": "^6.0.0", | ||
"@tools/fragments": "4.0.0" | ||
}, | ||
"gitHead": "40907de46bbebb4ea190822f03c33b3aec9547ac" | ||
"gitHead": "87aeb2c547d853ec3ffa0754bbff0d89a1c4d0cf" | ||
} |
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
95379
664
3
4
1