You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

@pixi/filter-reflection

Package Overview
Dependencies
Maintainers
3
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/filter-reflection - npm Package Compare versions

Comparing version

to
5.0.0

dist/filter-reflection.mjs

64

dist/filter-reflection.js

@@ -1,9 +0,63 @@

/*!
* @pixi/filter-reflection - v4.2.0
* Compiled Fri, 05 Aug 2022 19:53:35 UTC
"use strict";/*!
* @pixi/filter-reflection - v5.0.0
* Compiled Fri, 23 Sep 2022 20:48:56 UTC
*
* @pixi/filter-reflection is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license
*/
var __filters=function(e,r){"use strict";var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])})(e,r)};Object.create;Object.create;var n=function(e){function r(t){var n=e.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 vec4 filterClamp;\nuniform vec2 dimensions;\n\nuniform bool mirror;\nuniform float boundary;\nuniform vec2 amplitude;\nuniform vec2 waveLength;\nuniform vec2 alpha;\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 coord = pixelCoord / dimensions;\n\n if (coord.y < boundary) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n\n float k = (coord.y - boundary) / (1. - boundary + 0.0001);\n float areaY = boundary * dimensions.y / filterArea.y;\n float v = areaY + areaY - vTextureCoord.y;\n float y = mirror ? v : vTextureCoord.y;\n\n float _amplitude = ((amplitude.y - amplitude.x) * k + amplitude.x ) / filterArea.x;\n float _waveLength = ((waveLength.y - waveLength.x) * k + waveLength.x) / filterArea.y;\n float _alpha = (alpha.y - alpha.x) * k + alpha.x;\n\n float x = vTextureCoord.x + cos(v * 6.28 / _waveLength - time) * _amplitude;\n x = clamp(x, filterClamp.x, filterClamp.z);\n\n vec4 color = texture2D(uSampler, vec2(x, y));\n\n gl_FragColor = color * _alpha;\n}\n")||this;return n.time=0,n.uniforms.amplitude=new Float32Array(2),n.uniforms.waveLength=new Float32Array(2),n.uniforms.alpha=new Float32Array(2),n.uniforms.dimensions=new Float32Array(2),Object.assign(n,r.defaults,t),n}return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}(r,e),r.prototype.apply=function(e,r,t,n){var o,i;this.uniforms.dimensions[0]=null===(o=r.filterFrame)||void 0===o?void 0:o.width,this.uniforms.dimensions[1]=null===(i=r.filterFrame)||void 0===i?void 0:i.height,this.uniforms.time=this.time,e.applyFilter(this,r,t,n)},Object.defineProperty(r.prototype,"mirror",{get:function(){return this.uniforms.mirror},set:function(e){this.uniforms.mirror=e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"boundary",{get:function(){return this.uniforms.boundary},set:function(e){this.uniforms.boundary=e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"amplitude",{get:function(){return this.uniforms.amplitude},set:function(e){this.uniforms.amplitude[0]=e[0],this.uniforms.amplitude[1]=e[1]},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"waveLength",{get:function(){return this.uniforms.waveLength},set:function(e){this.uniforms.waveLength[0]=e[0],this.uniforms.waveLength[1]=e[1]},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"alpha",{get:function(){return this.uniforms.alpha},set:function(e){this.uniforms.alpha[0]=e[0],this.uniforms.alpha[1]=e[1]},enumerable:!1,configurable:!0}),r.defaults={mirror:!0,boundary:.5,amplitude:[0,20],waveLength:[30,100],alpha:[1,1],time:0},r}(r.Filter);return e.ReflectionFilter=n,Object.defineProperty(e,"__esModule",{value:!0}),e}({},PIXI);Object.assign(PIXI.filters,__filters);
*/Object.defineProperty(exports,"__esModule",{value:!0});var l=require("@pixi/core"),s=`attribute vec2 aVertexPosition;
attribute vec2 aTextureCoord;
uniform mat3 projectionMatrix;
varying vec2 vTextureCoord;
void main(void)
{
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
vTextureCoord = aTextureCoord;
}`,m=`varying vec2 vTextureCoord;
uniform sampler2D uSampler;
uniform vec4 filterArea;
uniform vec4 filterClamp;
uniform vec2 dimensions;
uniform bool mirror;
uniform float boundary;
uniform vec2 amplitude;
uniform vec2 waveLength;
uniform vec2 alpha;
uniform float time;
float rand(vec2 co) {
return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
}
void main(void)
{
vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;
vec2 coord = pixelCoord / dimensions;
if (coord.y < boundary) {
gl_FragColor = texture2D(uSampler, vTextureCoord);
return;
}
float k = (coord.y - boundary) / (1. - boundary + 0.0001);
float areaY = boundary * dimensions.y / filterArea.y;
float v = areaY + areaY - vTextureCoord.y;
float y = mirror ? v : vTextureCoord.y;
float _amplitude = ((amplitude.y - amplitude.x) * k + amplitude.x ) / filterArea.x;
float _waveLength = ((waveLength.y - waveLength.x) * k + waveLength.x) / filterArea.y;
float _alpha = (alpha.y - alpha.x) * k + alpha.x;
float x = vTextureCoord.x + cos(v * 6.28 / _waveLength - time) * _amplitude;
x = clamp(x, filterClamp.x, filterClamp.z);
vec4 color = texture2D(uSampler, vec2(x, y));
gl_FragColor = color * _alpha;
}
`;const i=class extends l.Filter{constructor(r){super(s,m),this.time=0,this.uniforms.amplitude=new Float32Array(2),this.uniforms.waveLength=new Float32Array(2),this.uniforms.alpha=new Float32Array(2),this.uniforms.dimensions=new Float32Array(2),Object.assign(this,i.defaults,r)}apply(r,e,a,u){var n,t;this.uniforms.dimensions[0]=(n=e.filterFrame)==null?void 0:n.width,this.uniforms.dimensions[1]=(t=e.filterFrame)==null?void 0:t.height,this.uniforms.time=this.time,r.applyFilter(this,e,a,u)}set mirror(r){this.uniforms.mirror=r}get mirror(){return this.uniforms.mirror}set boundary(r){this.uniforms.boundary=r}get boundary(){return this.uniforms.boundary}set amplitude(r){this.uniforms.amplitude[0]=r[0],this.uniforms.amplitude[1]=r[1]}get amplitude(){return this.uniforms.amplitude}set waveLength(r){this.uniforms.waveLength[0]=r[0],this.uniforms.waveLength[1]=r[1]}get waveLength(){return this.uniforms.waveLength}set alpha(r){this.uniforms.alpha[0]=r[0],this.uniforms.alpha[1]=r[1]}get alpha(){return this.uniforms.alpha}};let o=i;o.defaults={mirror:!0,boundary:.5,amplitude:[0,20],waveLength:[30,100],alpha:[1,1],time:0},exports.ReflectionFilter=o;
//# sourceMappingURL=filter-reflection.js.map

3

index.d.ts

@@ -1,2 +0,2 @@

import type { CLEAR_MODES } from '@pixi/constants';
import type { CLEAR_MODES } from '@pixi/core';
import { Filter } from '@pixi/core';

@@ -14,3 +14,2 @@ import type { FilterSystem } from '@pixi/core';

* @extends PIXI.Filter
* @memberof PIXI.filters
* @see {@link https://www.npmjs.com/package/@pixi/filter-reflection|@pixi/filter-reflection}

@@ -17,0 +16,0 @@ * @see {@link https://www.npmjs.com/package/pixi-filters|pixi-filters}

{
"name": "@pixi/filter-reflection",
"version": "4.2.0",
"main": "dist/filter-reflection.cjs.js",
"bundle": "dist/filter-reflection.js",
"version": "5.0.0",
"main": "./dist/filter-reflection.js",
"description": "PixiJS filter to apply reflection and wave effect",
"author": "finscn <finscn@gmail.com>",
"module": "dist/filter-reflection.esm.mjs",
"module": "./dist/filter-reflection.mjs",
"exports": {
".": {
"import": "./dist/filter-reflection.esm.mjs",
"require": "./dist/filter-reflection.cjs.js",
"import": "./dist/filter-reflection.mjs",
"require": "./dist/filter-reflection.js",
"types": "./index.d.ts"
}
},
"types": "index.d.ts",
"types": "./index.d.ts",
"homepage": "http://pixijs.com/",

@@ -33,11 +32,9 @@ "bugs": "https://github.com/pixijs/filters/issues",

"peerDependencies": {
"@pixi/constants": "^6.0.0",
"@pixi/core": "^6.0.0"
"@pixi/core": "^7.0.0-X"
},
"devDependencies": {
"@pixi/constants": "^6.0.0",
"@pixi/core": "^6.0.0",
"@tools/fragments": "4.1.3"
"@pixi/core": "^7.0.0-X",
"@tools/fragments": "5.0.0"
},
"gitHead": "dc16782d00fffb8c02d30cc32146d9c6a40599cb"
"gitHead": "2bec8c5024e4086e5aada8e471820bddc8ede687"
}

@@ -23,2 +23,2 @@ # AdjustBasicFilter

See https://pixijs.github.io/pixi-filters/docs
See https://filters.pixijs.download/main/docs/ReflectionFilter.html

Sorry, the diff of this file is not supported yet