pixi-filters
Advanced tools
Comparing version 1.0.0 to 1.0.3
@@ -0,8 +1,78 @@ | ||
/*! | ||
* pixi-filters - v1.0.3 | ||
* Compiled Mon Aug 08 2016 19:11:06 GMT-0400 (EDT) | ||
* | ||
* pixi-filters is licensed under the MIT License. | ||
* http://www.opensource.org/licenses/mit-license | ||
*/ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ascii = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
function AsciiFilter(){PIXI.Filter.call(this,"#define GLSLIFY 1\nattribute 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}","#define GLSLIFY 1\nvarying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform float pixelSize;\nuniform sampler2D uSampler;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 size)\n{\n return floor( coord / size ) * size;\n}\n\nvec2 getMod(vec2 coord, vec2 size)\n{\n return mod( coord , size) / size;\n}\n\nfloat character(float n, vec2 p)\n{\n p = floor(p*vec2(4.0, -4.0) + 2.5);\n if (clamp(p.x, 0.0, 4.0) == p.x && clamp(p.y, 0.0, 4.0) == p.y)\n {\n if (int(mod(n/exp2(p.x + 5.0*p.y), 2.0)) == 1) return 1.0;\n }\n return 0.0;\n}\n\nvoid main()\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n // get the rounded color..\n vec2 pixCoord = pixelate(coord, vec2(pixelSize));\n pixCoord = unmapCoord(pixCoord);\n\n vec4 color = texture2D(uSampler, pixCoord);\n\n // determine the character to use\n float gray = (color.r + color.g + color.b) / 3.0;\n\n float n = 65536.0; // .\n if (gray > 0.2) n = 65600.0; // :\n if (gray > 0.3) n = 332772.0; // *\n if (gray > 0.4) n = 15255086.0; // o\n if (gray > 0.5) n = 23385164.0; // &\n if (gray > 0.6) n = 15252014.0; // 8\n if (gray > 0.7) n = 13199452.0; // @\n if (gray > 0.8) n = 11512810.0; // #\n\n // get the mod..\n vec2 modd = getMod(coord, vec2(pixelSize));\n\n gl_FragColor = color * character( n, vec2(-1.0) + modd * 2.0);\n\n}"),this.size=8}AsciiFilter.prototype=Object.create(PIXI.Filter.prototype),AsciiFilter.prototype.constructor=AsciiFilter,module.exports=AsciiFilter,Object.defineProperties(AsciiFilter.prototype,{size:{get:function(){return this.uniforms.pixelSize},set:function(e){this.uniforms.pixelSize=e}}}); | ||
// TODO (cengler) - The Y is flipped in this shader for some reason. | ||
/** | ||
* @author Vico @vicocotea | ||
* original shader : https://www.shadertoy.com/view/lssGDj by @movAX13h | ||
*/ | ||
/** | ||
* An ASCII filter. | ||
* | ||
* @class | ||
* @extends PIXI.Filter | ||
* @memberof PIXI.filters | ||
*/ | ||
function AsciiFilter() | ||
{ | ||
PIXI.Filter.call(this, | ||
// vertex shader | ||
"#define GLSLIFY 1\nattribute 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 shader | ||
"#define GLSLIFY 1\nvarying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform float pixelSize;\nuniform sampler2D uSampler;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 size)\n{\n return floor( coord / size ) * size;\n}\n\nvec2 getMod(vec2 coord, vec2 size)\n{\n return mod( coord , size) / size;\n}\n\nfloat character(float n, vec2 p)\n{\n p = floor(p*vec2(4.0, -4.0) + 2.5);\n if (clamp(p.x, 0.0, 4.0) == p.x && clamp(p.y, 0.0, 4.0) == p.y)\n {\n if (int(mod(n/exp2(p.x + 5.0*p.y), 2.0)) == 1) return 1.0;\n }\n return 0.0;\n}\n\nvoid main()\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n // get the rounded color..\n vec2 pixCoord = pixelate(coord, vec2(pixelSize));\n pixCoord = unmapCoord(pixCoord);\n\n vec4 color = texture2D(uSampler, pixCoord);\n\n // determine the character to use\n float gray = (color.r + color.g + color.b) / 3.0;\n\n float n = 65536.0; // .\n if (gray > 0.2) n = 65600.0; // :\n if (gray > 0.3) n = 332772.0; // *\n if (gray > 0.4) n = 15255086.0; // o\n if (gray > 0.5) n = 23385164.0; // &\n if (gray > 0.6) n = 15252014.0; // 8\n if (gray > 0.7) n = 13199452.0; // @\n if (gray > 0.8) n = 11512810.0; // #\n\n // get the mod..\n vec2 modd = getMod(coord, vec2(pixelSize));\n\n gl_FragColor = color * character( n, vec2(-1.0) + modd * 2.0);\n\n}" | ||
); | ||
this.size = 8; | ||
} | ||
AsciiFilter.prototype = Object.create(PIXI.Filter.prototype); | ||
AsciiFilter.prototype.constructor = AsciiFilter; | ||
module.exports = AsciiFilter; | ||
Object.defineProperties(AsciiFilter.prototype, { | ||
/** | ||
* The pixel size used by the filter. | ||
* | ||
* @member {number} | ||
* @memberof PIXI.filters.AsciiFilter# | ||
*/ | ||
size: { | ||
get: function () | ||
{ | ||
return this.uniforms.pixelSize; | ||
}, | ||
set: function (value) | ||
{ | ||
this.uniforms.pixelSize = value; | ||
} | ||
} | ||
}); | ||
},{}],2:[function(require,module,exports){ | ||
require("../check");var filter=PIXI.filters.AsciiFilter=require("./AsciiFilter");"undefined"!=typeof module&&module.exports&&(module.exports=filter); | ||
require('../check'); | ||
var filter = PIXI.filters.AsciiFilter = require('./AsciiFilter'); | ||
// Export for requiring | ||
if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = filter; | ||
} | ||
},{"../check":3,"./AsciiFilter":1}],3:[function(require,module,exports){ | ||
if("undefined"==typeof PIXI)throw new Error("pixi.js is required to be included"); | ||
// Make sure PIXI global object is available | ||
if (typeof PIXI === "undefined") { | ||
throw new Error('pixi.js is required to be included'); | ||
} | ||
},{}]},{},[2])(2) | ||
}); | ||
}); | ||
//# sourceMappingURL=ascii.js.map |
124
bin/bloom.js
@@ -0,8 +1,124 @@ | ||
/*! | ||
* pixi-filters - v1.0.3 | ||
* Compiled Mon Aug 08 2016 19:11:08 GMT-0400 (EDT) | ||
* | ||
* pixi-filters is licensed under the MIT License. | ||
* http://www.opensource.org/licenses/mit-license | ||
*/ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.bloom = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
function BloomFilter(){PIXI.Filter.call(this),this.blurXFilter=new BlurXFilter,this.blurYFilter=new BlurYFilter,this.blurYFilter.blendMode=PIXI.BLEND_MODES.SCREEN,this.defaultFilter=new VoidFilter}var BlurXFilter=PIXI.filters.BlurXFilter,BlurYFilter=PIXI.filters.BlurYFilter,VoidFilter=PIXI.filters.VoidFilter;BloomFilter.prototype=Object.create(PIXI.Filter.prototype),BloomFilter.prototype.constructor=BloomFilter,module.exports=BloomFilter,BloomFilter.prototype.apply=function(t,r,l){var e=t.getRenderTarget(!0);this.defaultFilter.apply(t,r,l),this.blurXFilter.apply(t,r,e),this.blurYFilter.apply(t,e,l),t.returnRenderTarget(e)},Object.defineProperties(BloomFilter.prototype,{blur:{get:function(){return this.blurXFilter.blur},set:function(t){this.blurXFilter.blur=this.blurYFilter.blur=t}},blurX:{get:function(){return this.blurXFilter.blur},set:function(t){this.blurXFilter.blur=t}},blurY:{get:function(){return this.blurYFilter.blur},set:function(t){this.blurYFilter.blur=t}}}); | ||
var BlurXFilter = PIXI.filters.BlurXFilter, | ||
BlurYFilter = PIXI.filters.BlurYFilter, | ||
VoidFilter = PIXI.filters.VoidFilter; | ||
/** | ||
* The BloomFilter applies a Gaussian blur to an object. | ||
* The strength of the blur can be set for x- and y-axis separately. | ||
* | ||
* @class | ||
* @extends PIXI.Filter | ||
* @memberof PIXI.filters | ||
*/ | ||
function BloomFilter() | ||
{ | ||
PIXI.Filter.call(this); | ||
this.blurXFilter = new BlurXFilter(); | ||
this.blurYFilter = new BlurYFilter(); | ||
this.blurYFilter.blendMode = PIXI.BLEND_MODES.SCREEN; | ||
this.defaultFilter = new VoidFilter(); | ||
} | ||
BloomFilter.prototype = Object.create(PIXI.Filter.prototype); | ||
BloomFilter.prototype.constructor = BloomFilter; | ||
module.exports = BloomFilter; | ||
BloomFilter.prototype.apply = function (filterManager, input, output) | ||
{ | ||
var renderTarget = filterManager.getRenderTarget(true); | ||
//TODO - copyTexSubImage2D could be used here? | ||
this.defaultFilter.apply(filterManager, input, output); | ||
this.blurXFilter.apply(filterManager, input, renderTarget); | ||
this.blurYFilter.apply(filterManager, renderTarget, output); | ||
filterManager.returnRenderTarget(renderTarget); | ||
}; | ||
Object.defineProperties(BloomFilter.prototype, { | ||
/** | ||
* Sets the strength of both the blurX and blurY properties simultaneously | ||
* | ||
* @member {number} | ||
* @memberOf PIXI.filters.BloomFilter# | ||
* @default 2 | ||
*/ | ||
blur: { | ||
get: function () | ||
{ | ||
return this.blurXFilter.blur; | ||
}, | ||
set: function (value) | ||
{ | ||
this.blurXFilter.blur = this.blurYFilter.blur = value; | ||
} | ||
}, | ||
/** | ||
* Sets the strength of the blurX property | ||
* | ||
* @member {number} | ||
* @memberOf PIXI.filters.BloomFilter# | ||
* @default 2 | ||
*/ | ||
blurX: { | ||
get: function () | ||
{ | ||
return this.blurXFilter.blur; | ||
}, | ||
set: function (value) | ||
{ | ||
this.blurXFilter.blur = value; | ||
} | ||
}, | ||
/** | ||
* Sets the strength of the blurY property | ||
* | ||
* @member {number} | ||
* @memberOf PIXI.filters.BloomFilter# | ||
* @default 2 | ||
*/ | ||
blurY: { | ||
get: function () | ||
{ | ||
return this.blurYFilter.blur; | ||
}, | ||
set: function (value) | ||
{ | ||
this.blurYFilter.blur = value; | ||
} | ||
} | ||
}); | ||
},{}],2:[function(require,module,exports){ | ||
require("../check");var filter=PIXI.filters.BloomFilter=require("./BloomFilter");"undefined"!=typeof module&&module.exports&&(module.exports=filter); | ||
require('../check'); | ||
var filter = PIXI.filters.BloomFilter = require('./BloomFilter'); | ||
// Export for requiring | ||
if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = filter; | ||
} | ||
},{"../check":3,"./BloomFilter":1}],3:[function(require,module,exports){ | ||
if("undefined"==typeof PIXI)throw new Error("pixi.js is required to be included"); | ||
// Make sure PIXI global object is available | ||
if (typeof PIXI === "undefined") { | ||
throw new Error('pixi.js is required to be included'); | ||
} | ||
},{}]},{},[2])(2) | ||
}); | ||
}); | ||
//# sourceMappingURL=bloom.js.map |
@@ -0,8 +1,114 @@ | ||
/*! | ||
* pixi-filters - v1.0.3 | ||
* Compiled Mon Aug 08 2016 19:11:09 GMT-0400 (EDT) | ||
* | ||
* pixi-filters is licensed under the MIT License. | ||
* http://www.opensource.org/licenses/mit-license | ||
*/ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.convolution = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
if("undefined"==typeof PIXI)throw new Error("pixi.js is required to be included"); | ||
// Make sure PIXI global object is available | ||
if (typeof PIXI === "undefined") { | ||
throw new Error('pixi.js is required to be included'); | ||
} | ||
},{}],2:[function(require,module,exports){ | ||
function ConvolutionFilter(e,t,r){PIXI.Filter.call(this,"#define GLSLIFY 1\nattribute 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}","precision mediump float;\n#define GLSLIFY 1\n\nvarying mediump vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec2 texelSize;\nuniform float matrix[9];\n\nvoid main(void)\n{\n vec4 c11 = texture2D(uSampler, vTextureCoord - texelSize); // top left\n vec4 c12 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - texelSize.y)); // top center\n vec4 c13 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y - texelSize.y)); // top right\n\n vec4 c21 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y)); // mid left\n vec4 c22 = texture2D(uSampler, vTextureCoord); // mid center\n vec4 c23 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y)); // mid right\n\n vec4 c31 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y + texelSize.y)); // bottom left\n vec4 c32 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + texelSize.y)); // bottom center\n vec4 c33 = texture2D(uSampler, vTextureCoord + texelSize); // bottom right\n\n gl_FragColor =\n c11 * matrix[0] + c12 * matrix[1] + c13 * matrix[2] +\n c21 * matrix[3] + c22 * matrix[4] + c23 * matrix[5] +\n c31 * matrix[6] + c32 * matrix[7] + c33 * matrix[8];\n\n gl_FragColor.a = c22.a;\n}\n"),this.matrix=e,this.width=t,this.height=r}ConvolutionFilter.prototype=Object.create(PIXI.Filter.prototype),ConvolutionFilter.prototype.constructor=ConvolutionFilter,module.exports=ConvolutionFilter,Object.defineProperties(ConvolutionFilter.prototype,{matrix:{get:function(){return this.uniforms.matrix},set:function(e){this.uniforms.matrix=new Float32Array(e)}},width:{get:function(){return 1/this.uniforms.texelSize[0]},set:function(e){this.uniforms.texelSize[0]=1/e}},height:{get:function(){return 1/this.uniforms.texelSize[1]},set:function(e){this.uniforms.texelSize[1]=1/e}}}); | ||
/** | ||
* The ConvolutionFilter class applies a matrix convolution filter effect. | ||
* A convolution combines pixels in the input image with neighboring pixels to produce a new image. | ||
* A wide variety of image effects can be achieved through convolutions, including blurring, edge | ||
* detection, sharpening, embossing, and beveling. The matrix should be specified as a 9 point Array. | ||
* See http://docs.gimp.org/en/plug-in-convmatrix.html for more info. | ||
* | ||
* @class | ||
* @extends PIXI.Filter | ||
* @memberof PIXI.filters | ||
* @param matrix {number[]} An array of values used for matrix transformation. Specified as a 9 point Array. | ||
* @param width {number} Width of the object you are transforming | ||
* @param height {number} Height of the object you are transforming | ||
*/ | ||
function ConvolutionFilter(matrix, width, height) | ||
{ | ||
PIXI.Filter.call(this, | ||
// vertex shader | ||
"#define GLSLIFY 1\nattribute 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 shader | ||
"precision mediump float;\n#define GLSLIFY 1\n\nvarying mediump vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec2 texelSize;\nuniform float matrix[9];\n\nvoid main(void)\n{\n vec4 c11 = texture2D(uSampler, vTextureCoord - texelSize); // top left\n vec4 c12 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - texelSize.y)); // top center\n vec4 c13 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y - texelSize.y)); // top right\n\n vec4 c21 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y)); // mid left\n vec4 c22 = texture2D(uSampler, vTextureCoord); // mid center\n vec4 c23 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y)); // mid right\n\n vec4 c31 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y + texelSize.y)); // bottom left\n vec4 c32 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + texelSize.y)); // bottom center\n vec4 c33 = texture2D(uSampler, vTextureCoord + texelSize); // bottom right\n\n gl_FragColor =\n c11 * matrix[0] + c12 * matrix[1] + c13 * matrix[2] +\n c21 * matrix[3] + c22 * matrix[4] + c23 * matrix[5] +\n c31 * matrix[6] + c32 * matrix[7] + c33 * matrix[8];\n\n gl_FragColor.a = c22.a;\n}\n" | ||
); | ||
this.matrix = matrix; | ||
this.width = width; | ||
this.height = height; | ||
} | ||
ConvolutionFilter.prototype = Object.create(PIXI.Filter.prototype); | ||
ConvolutionFilter.prototype.constructor = ConvolutionFilter; | ||
module.exports = ConvolutionFilter; | ||
Object.defineProperties(ConvolutionFilter.prototype, { | ||
/** | ||
* An array of values used for matrix transformation. Specified as a 9 point Array. | ||
* | ||
* @member {number[]} | ||
* @memberof PIXI.filters.ConvolutionFilter# | ||
*/ | ||
matrix: { | ||
get: function () | ||
{ | ||
return this.uniforms.matrix; | ||
}, | ||
set: function (value) | ||
{ | ||
this.uniforms.matrix = new Float32Array(value); | ||
} | ||
}, | ||
/** | ||
* Width of the object you are transforming | ||
* | ||
* @member {number} | ||
* @memberof PIXI.filters.ConvolutionFilter# | ||
*/ | ||
width: { | ||
get: function () | ||
{ | ||
return 1/this.uniforms.texelSize[0]; | ||
}, | ||
set: function (value) | ||
{ | ||
this.uniforms.texelSize[0] = 1/value; | ||
} | ||
}, | ||
/** | ||
* Height of the object you are transforming | ||
* | ||
* @member {number} | ||
* @memberof PIXI.filters.ConvolutionFilter# | ||
*/ | ||
height: { | ||
get: function () | ||
{ | ||
return 1/this.uniforms.texelSize[1]; | ||
}, | ||
set: function (value) | ||
{ | ||
this.uniforms.texelSize[1] = 1/value; | ||
} | ||
} | ||
}); | ||
},{}],3:[function(require,module,exports){ | ||
require("../check");var filter=PIXI.filters.ConvolutionFilter=require("./ConvolutionFilter");"undefined"!=typeof module&&module.exports&&(module.exports=filter); | ||
require('../check'); | ||
var filter = PIXI.filters.ConvolutionFilter = require('./ConvolutionFilter'); | ||
// Export for requiring | ||
if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = filter; | ||
} | ||
},{"../check":1,"./ConvolutionFilter":2}]},{},[3])(3) | ||
}); | ||
}); | ||
//# sourceMappingURL=convolution.js.map |
@@ -0,8 +1,50 @@ | ||
/*! | ||
* pixi-filters - v1.0.3 | ||
* Compiled Mon Aug 08 2016 19:11:10 GMT-0400 (EDT) | ||
* | ||
* pixi-filters is licensed under the MIT License. | ||
* http://www.opensource.org/licenses/mit-license | ||
*/ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.crosshatch = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
if("undefined"==typeof PIXI)throw new Error("pixi.js is required to be included"); | ||
// Make sure PIXI global object is available | ||
if (typeof PIXI === "undefined") { | ||
throw new Error('pixi.js is required to be included'); | ||
} | ||
},{}],2:[function(require,module,exports){ | ||
function CrossHatchFilter(){PIXI.Filter.call(this,"#define GLSLIFY 1\nattribute 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}","precision mediump float;\n#define GLSLIFY 1\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n float lum = length(texture2D(uSampler, vTextureCoord.xy).rgb);\n\n gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);\n\n if (lum < 1.00)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.75)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.50)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.3)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n}\n")}CrossHatchFilter.prototype=Object.create(PIXI.Filter.prototype),CrossHatchFilter.prototype.constructor=CrossHatchFilter,module.exports=CrossHatchFilter; | ||
/** | ||
* A Cross Hatch effect filter. | ||
* | ||
* @class | ||
* @extends PIXI.Filter | ||
* @memberof PIXI.filters | ||
*/ | ||
function CrossHatchFilter() | ||
{ | ||
PIXI.Filter.call(this, | ||
// vertex shader | ||
"#define GLSLIFY 1\nattribute 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 shader | ||
"precision mediump float;\n#define GLSLIFY 1\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n float lum = length(texture2D(uSampler, vTextureCoord.xy).rgb);\n\n gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);\n\n if (lum < 1.00)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.75)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.50)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.3)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n}\n" | ||
); | ||
} | ||
CrossHatchFilter.prototype = Object.create(PIXI.Filter.prototype); | ||
CrossHatchFilter.prototype.constructor = CrossHatchFilter; | ||
module.exports = CrossHatchFilter; | ||
},{}],3:[function(require,module,exports){ | ||
require("../check");var filter=PIXI.filters.CrossHatchFilter=require("./CrossHatchFilter");"undefined"!=typeof module&&module.exports&&(module.exports=filter); | ||
require('../check'); | ||
var filter = PIXI.filters.CrossHatchFilter = require('./CrossHatchFilter'); | ||
// Export for requiring | ||
if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = filter; | ||
} | ||
},{"../check":1,"./CrossHatchFilter":2}]},{},[3])(3) | ||
}); | ||
}); | ||
//# sourceMappingURL=crosshatch.js.map |
@@ -0,8 +1,93 @@ | ||
/*! | ||
* pixi-filters - v1.0.3 | ||
* Compiled Mon Aug 08 2016 19:11:12 GMT-0400 (EDT) | ||
* | ||
* pixi-filters is licensed under the MIT License. | ||
* http://www.opensource.org/licenses/mit-license | ||
*/ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.dot = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
if("undefined"==typeof PIXI)throw new Error("pixi.js is required to be included"); | ||
// Make sure PIXI global object is available | ||
if (typeof PIXI === "undefined") { | ||
throw new Error('pixi.js is required to be included'); | ||
} | ||
},{}],2:[function(require,module,exports){ | ||
function DotFilter(){PIXI.Filter.call(this,"#define GLSLIFY 1\nattribute 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}","precision mediump float;\n#define GLSLIFY 1\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform vec4 filterArea;\nuniform sampler2D uSampler;\n\nuniform float angle;\nuniform float scale;\n\nfloat pattern()\n{\n float s = sin(angle), c = cos(angle);\n vec2 tex = vTextureCoord * filterArea.xy;\n vec2 point = vec2(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float average = (color.r + color.g + color.b) / 3.0;\n gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);\n}\n"),this.scale=1,this.angle=5}DotFilter.prototype=Object.create(PIXI.Filter.prototype),DotFilter.prototype.constructor=DotFilter,module.exports=DotFilter,Object.defineProperties(DotFilter.prototype,{scale:{get:function(){return this.uniforms.scale},set:function(e){this.uniforms.scale=e}},angle:{get:function(){return this.uniforms.angle},set:function(e){this.uniforms.angle=e}}}); | ||
/** | ||
* @author Mat Groves http://matgroves.com/ @Doormat23 | ||
* original filter: https://github.com/evanw/glfx.js/blob/master/src/filters/fun/dotscreen.js | ||
*/ | ||
/** | ||
* This filter applies a dotscreen effect making display objects appear to be made out of | ||
* black and white halftone dots like an old printer. | ||
* | ||
* @class | ||
* @extends PIXI.Filter | ||
* @memberof PIXI.filters | ||
*/ | ||
function DotFilter() | ||
{ | ||
PIXI.Filter.call(this, | ||
// vertex shader | ||
"#define GLSLIFY 1\nattribute 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 shader | ||
"precision mediump float;\n#define GLSLIFY 1\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform vec4 filterArea;\nuniform sampler2D uSampler;\n\nuniform float angle;\nuniform float scale;\n\nfloat pattern()\n{\n float s = sin(angle), c = cos(angle);\n vec2 tex = vTextureCoord * filterArea.xy;\n vec2 point = vec2(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float average = (color.r + color.g + color.b) / 3.0;\n gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);\n}\n" | ||
); | ||
this.scale = 1; | ||
this.angle = 5; | ||
} | ||
DotFilter.prototype = Object.create(PIXI.Filter.prototype); | ||
DotFilter.prototype.constructor = DotFilter; | ||
module.exports = DotFilter; | ||
Object.defineProperties(DotFilter.prototype, { | ||
/** | ||
* The scale of the effect. | ||
* @member {number} | ||
* @memberof PIXI.filters.DotFilter# | ||
*/ | ||
scale: { | ||
get: function () | ||
{ | ||
return this.uniforms.scale; | ||
}, | ||
set: function (value) | ||
{ | ||
this.uniforms.scale = value; | ||
} | ||
}, | ||
/** | ||
* The radius of the effect. | ||
* @member {number} | ||
* @memberof PIXI.filters.DotFilter# | ||
*/ | ||
angle: { | ||
get: function () | ||
{ | ||
return this.uniforms.angle; | ||
}, | ||
set: function (value) | ||
{ | ||
this.uniforms.angle = value; | ||
} | ||
} | ||
}); | ||
},{}],3:[function(require,module,exports){ | ||
require("../check");var filter=PIXI.filters.DotFilter=require("./DotFilter");"undefined"!=typeof module&&module.exports&&(module.exports=filter); | ||
require('../check'); | ||
var filter = PIXI.filters.DotFilter = require('./DotFilter'); | ||
// Export for requiring | ||
if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = filter; | ||
} | ||
},{"../check":1,"./DotFilter":2}]},{},[3])(3) | ||
}); | ||
}); | ||
//# sourceMappingURL=dot.js.map |
@@ -0,8 +1,73 @@ | ||
/*! | ||
* pixi-filters - v1.0.3 | ||
* Compiled Mon Aug 08 2016 19:11:13 GMT-0400 (EDT) | ||
* | ||
* pixi-filters is licensed under the MIT License. | ||
* http://www.opensource.org/licenses/mit-license | ||
*/ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.emboss = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
if("undefined"==typeof PIXI)throw new Error("pixi.js is required to be included"); | ||
// Make sure PIXI global object is available | ||
if (typeof PIXI === "undefined") { | ||
throw new Error('pixi.js is required to be included'); | ||
} | ||
},{}],2:[function(require,module,exports){ | ||
function EmbossFilter(){PIXI.Filter.call(this,"#define GLSLIFY 1\nattribute 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}","precision mediump float;\n#define GLSLIFY 1\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float strength;\nuniform vec4 filterArea;\n\nvoid main(void)\n{\n\tvec2 onePixel = vec2(1.0 / filterArea);\n\n\tvec4 color;\n\n\tcolor.rgb = vec3(0.5);\n\n\tcolor -= texture2D(uSampler, vTextureCoord - onePixel) * strength;\n\tcolor += texture2D(uSampler, vTextureCoord + onePixel) * strength;\n\n\tcolor.rgb = vec3((color.r + color.g + color.b) / 3.0);\n\n\tfloat alpha = texture2D(uSampler, vTextureCoord).a;\n\n\tgl_FragColor = vec4(color.rgb * alpha, alpha);\n}\n"),this.strength=5}EmbossFilter.prototype=Object.create(PIXI.Filter.prototype),EmbossFilter.prototype.constructor=EmbossFilter,module.exports=EmbossFilter,Object.defineProperties(EmbossFilter.prototype,{strength:{get:function(){return this.uniforms.strength},set:function(e){this.uniforms.strength=e}}}); | ||
/** | ||
* An RGB Split Filter. | ||
* | ||
* @class | ||
* @extends PIXI.Filter | ||
* @memberof PIXI.filters | ||
*/ | ||
function EmbossFilter() | ||
{ | ||
PIXI.Filter.call(this, | ||
// vertex shader | ||
"#define GLSLIFY 1\nattribute 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 shader | ||
"precision mediump float;\n#define GLSLIFY 1\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float strength;\nuniform vec4 filterArea;\n\nvoid main(void)\n{\n\tvec2 onePixel = vec2(1.0 / filterArea);\n\n\tvec4 color;\n\n\tcolor.rgb = vec3(0.5);\n\n\tcolor -= texture2D(uSampler, vTextureCoord - onePixel) * strength;\n\tcolor += texture2D(uSampler, vTextureCoord + onePixel) * strength;\n\n\tcolor.rgb = vec3((color.r + color.g + color.b) / 3.0);\n\n\tfloat alpha = texture2D(uSampler, vTextureCoord).a;\n\n\tgl_FragColor = vec4(color.rgb * alpha, alpha);\n}\n" | ||
); | ||
this.strength = 5; | ||
} | ||
EmbossFilter.prototype = Object.create(PIXI.Filter.prototype); | ||
EmbossFilter.prototype.constructor = EmbossFilter; | ||
module.exports = EmbossFilter; | ||
Object.defineProperties(EmbossFilter.prototype, { | ||
/** | ||
* Strength of Emboss. | ||
* | ||
* @member {PIXI.Point} | ||
* @memberof PIXI.filters.EmbossFilter# | ||
*/ | ||
strength: { | ||
get: function () | ||
{ | ||
return this.uniforms.strength; | ||
}, | ||
set: function (value) | ||
{ | ||
this.uniforms.strength = value; | ||
} | ||
}, | ||
}); | ||
},{}],3:[function(require,module,exports){ | ||
require("../check");var filter=PIXI.filters.EmbossFilter=require("./EmbossFilter");"undefined"!=typeof module&&module.exports&&(module.exports=filter); | ||
require('../check'); | ||
var filter = PIXI.filters.EmbossFilter = require('./EmbossFilter'); | ||
// Export for requiring | ||
if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = filter; | ||
} | ||
},{"../check":1,"./EmbossFilter":2}]},{},[3])(3) | ||
}); | ||
}); | ||
//# sourceMappingURL=emboss.js.map |
@@ -0,8 +1,74 @@ | ||
/*! | ||
* pixi-filters - v1.0.3 | ||
* Compiled Mon Aug 08 2016 19:11:15 GMT-0400 (EDT) | ||
* | ||
* pixi-filters is licensed under the MIT License. | ||
* http://www.opensource.org/licenses/mit-license | ||
*/ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.pixelate = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
if("undefined"==typeof PIXI)throw new Error("pixi.js is required to be included"); | ||
// Make sure PIXI global object is available | ||
if (typeof PIXI === "undefined") { | ||
throw new Error('pixi.js is required to be included'); | ||
} | ||
},{}],2:[function(require,module,exports){ | ||
function PixelateFilter(){PIXI.Filter.call(this,"#define GLSLIFY 1\nattribute 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}","precision mediump float;\n#define GLSLIFY 1\n\nvarying vec2 vTextureCoord;\n\nuniform vec2 size;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 size)\n{\n\treturn floor( coord / size ) * size;\n}\n\nvoid main(void)\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n coord = pixelate(coord, size);\n\n coord = unmapCoord(coord);\n\n gl_FragColor = texture2D(uSampler, coord);\n}\n"),this.size=[10,10]}PixelateFilter.prototype=Object.create(PIXI.Filter.prototype),PixelateFilter.prototype.constructor=PixelateFilter,module.exports=PixelateFilter,Object.defineProperties(PixelateFilter.prototype,{size:{get:function(){return this.uniforms.size},set:function(e){this.uniforms.size.value=e}}}); | ||
// @see https://github.com/substack/brfs/issues/25 | ||
/** | ||
* This filter applies a pixelate effect making display objects appear 'blocky'. | ||
* | ||
* @class | ||
* @extends PIXI.AbstractFilter | ||
* @memberof PIXI.filters | ||
*/ | ||
function PixelateFilter() | ||
{ | ||
PIXI.Filter.call(this, | ||
// vertex shader | ||
"#define GLSLIFY 1\nattribute 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 shader | ||
"precision mediump float;\n#define GLSLIFY 1\n\nvarying vec2 vTextureCoord;\n\nuniform vec2 size;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 size)\n{\n\treturn floor( coord / size ) * size;\n}\n\nvoid main(void)\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n coord = pixelate(coord, size);\n\n coord = unmapCoord(coord);\n\n gl_FragColor = texture2D(uSampler, coord);\n}\n" | ||
); | ||
this.size = [10,10]; | ||
} | ||
PixelateFilter.prototype = Object.create(PIXI.Filter.prototype); | ||
PixelateFilter.prototype.constructor = PixelateFilter; | ||
module.exports = PixelateFilter; | ||
Object.defineProperties(PixelateFilter.prototype, { | ||
/** | ||
* This a point that describes the size of the blocks. | ||
* x is the width of the block and y is the height. | ||
* | ||
* @member {PIXI.Point} | ||
* @memberof PIXI.filters.PixelateFilter# | ||
*/ | ||
size: { | ||
get: function () | ||
{ | ||
return this.uniforms.size; | ||
}, | ||
set: function (value) | ||
{ | ||
this.uniforms.size.value = value; | ||
} | ||
} | ||
}); | ||
},{}],3:[function(require,module,exports){ | ||
require("../check");var filter=PIXI.filters.PixelateFilter=require("./PixelateFilter");"undefined"!=typeof module&&module.exports&&(module.exports=filter); | ||
require('../check'); | ||
var filter = PIXI.filters.PixelateFilter = require('./PixelateFilter'); | ||
// Export for requiring | ||
if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = filter; | ||
} | ||
},{"../check":1,"./PixelateFilter":2}]},{},[3])(3) | ||
}); | ||
}); | ||
//# sourceMappingURL=pixelate.js.map |
107
bin/rgb.js
@@ -0,8 +1,107 @@ | ||
/*! | ||
* pixi-filters - v1.0.3 | ||
* Compiled Mon Aug 08 2016 19:11:16 GMT-0400 (EDT) | ||
* | ||
* pixi-filters is licensed under the MIT License. | ||
* http://www.opensource.org/licenses/mit-license | ||
*/ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.rgb = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
if("undefined"==typeof PIXI)throw new Error("pixi.js is required to be included"); | ||
// Make sure PIXI global object is available | ||
if (typeof PIXI === "undefined") { | ||
throw new Error('pixi.js is required to be included'); | ||
} | ||
},{}],2:[function(require,module,exports){ | ||
function RGBSplitFilter(){PIXI.Filter.call(this,"#define GLSLIFY 1\nattribute 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}","precision mediump float;\n#define GLSLIFY 1\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nvoid main(void)\n{\n gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/filterArea.xy).r;\n gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/filterArea.xy).g;\n gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/filterArea.xy).b;\n gl_FragColor.a = texture2D(uSampler, vTextureCoord).a;\n}\n"),this.red=[-10,0],this.green=[0,10],this.blue=[0,0]}RGBSplitFilter.prototype=Object.create(PIXI.Filter.prototype),RGBSplitFilter.prototype.constructor=RGBSplitFilter,module.exports=RGBSplitFilter,Object.defineProperties(RGBSplitFilter.prototype,{red:{get:function(){return this.uniforms.red},set:function(e){this.uniforms.red=e}},green:{get:function(){return this.uniforms.green},set:function(e){this.uniforms.green=e}},blue:{get:function(){return this.uniforms.blue.value},set:function(e){this.uniforms.blue.value=e}}}); | ||
/** | ||
* An RGB Split Filter. | ||
* | ||
* @class | ||
* @extends PIXI.Filter | ||
* @memberof PIXI.filters | ||
*/ | ||
function RGBSplitFilter() | ||
{ | ||
PIXI.Filter.call(this, | ||
// vertex shader | ||
"#define GLSLIFY 1\nattribute 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 shader | ||
"precision mediump float;\n#define GLSLIFY 1\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nvoid main(void)\n{\n gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/filterArea.xy).r;\n gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/filterArea.xy).g;\n gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/filterArea.xy).b;\n gl_FragColor.a = texture2D(uSampler, vTextureCoord).a;\n}\n" | ||
); | ||
this.red = [-10, 0]; | ||
this.green = [0, 10]; | ||
this.blue = [0, 0]; | ||
} | ||
RGBSplitFilter.prototype = Object.create(PIXI.Filter.prototype); | ||
RGBSplitFilter.prototype.constructor = RGBSplitFilter; | ||
module.exports = RGBSplitFilter; | ||
Object.defineProperties(RGBSplitFilter.prototype, { | ||
/** | ||
* Red channel offset. | ||
* | ||
* @member {PIXI.Point} | ||
* @memberof PIXI.filters.RGBSplitFilter# | ||
*/ | ||
red: { | ||
get: function () | ||
{ | ||
return this.uniforms.red; | ||
}, | ||
set: function (value) | ||
{ | ||
this.uniforms.red = value; | ||
} | ||
}, | ||
/** | ||
* Green channel offset. | ||
* | ||
* @member {PIXI.Point} | ||
* @memberof PIXI.filters.RGBSplitFilter# | ||
*/ | ||
green: { | ||
get: function () | ||
{ | ||
return this.uniforms.green; | ||
}, | ||
set: function (value) | ||
{ | ||
this.uniforms.green = value; | ||
} | ||
}, | ||
/** | ||
* Blue offset. | ||
* | ||
* @member {PIXI.Point} | ||
* @memberof PIXI.filters.RGBSplitFilter# | ||
*/ | ||
blue: { | ||
get: function () | ||
{ | ||
return this.uniforms.blue.value; | ||
}, | ||
set: function (value) | ||
{ | ||
this.uniforms.blue.value = value; | ||
} | ||
} | ||
}); | ||
},{}],3:[function(require,module,exports){ | ||
require("../check");var filter=PIXI.filters.RGBSplitFilter=require("./RGBSplitFilter");"undefined"!=typeof module&&module.exports&&(module.exports=filter); | ||
require('../check'); | ||
var filter = PIXI.filters.RGBSplitFilter = require('./RGBSplitFilter'); | ||
// Export for requiring | ||
if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = filter; | ||
} | ||
},{"../check":1,"./RGBSplitFilter":2}]},{},[3])(3) | ||
}); | ||
}); | ||
//# sourceMappingURL=rgb.js.map |
@@ -0,8 +1,116 @@ | ||
/*! | ||
* pixi-filters - v1.0.3 | ||
* Compiled Mon Aug 08 2016 19:11:17 GMT-0400 (EDT) | ||
* | ||
* pixi-filters is licensed under the MIT License. | ||
* http://www.opensource.org/licenses/mit-license | ||
*/ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.shockwave = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
if("undefined"==typeof PIXI)throw new Error("pixi.js is required to be included"); | ||
// Make sure PIXI global object is available | ||
if (typeof PIXI === "undefined") { | ||
throw new Error('pixi.js is required to be included'); | ||
} | ||
},{}],2:[function(require,module,exports){ | ||
function ShockwaveFilter(){PIXI.Filter.call(this,"#define GLSLIFY 1\nattribute 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}","#define GLSLIFY 1\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nuniform vec2 center;\nuniform vec3 params; // 10.0, 0.8, 0.1\nuniform float time;\n\nvoid main()\n{\n vec2 uv = vTextureCoord;\n vec2 texCoord = uv;\n\n float dist = distance(uv, 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 texCoord = uv + (diffUV * diffTime);\n }\n\n gl_FragColor = texture2D(uSampler, texCoord);\n}\n",{center:{type:"v2",value:{x:.5,y:.5}},params:{type:"v3",value:{x:10,y:.8,z:.1}},time:{type:"1f",value:0}}),this.center=[.5,.5],this.params=[10,.8,.1],this.time=0}ShockwaveFilter.prototype=Object.create(PIXI.Filter.prototype),ShockwaveFilter.prototype.constructor=ShockwaveFilter,module.exports=ShockwaveFilter,Object.defineProperties(ShockwaveFilter.prototype,{center:{get:function(){return this.uniforms.center},set:function(e){this.uniforms.center=e}},params:{get:function(){return this.uniforms.params},set:function(e){this.uniforms.params=e}},time:{get:function(){return this.uniforms.time},set:function(e){this.uniforms.time=e}}}); | ||
/** | ||
* 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! | ||
* | ||
* @class | ||
* @extends PIXI.Filter | ||
* @memberof PIXI.filters | ||
*/ | ||
function ShockwaveFilter() | ||
{ | ||
PIXI.Filter.call(this, | ||
// vertex shader | ||
"#define GLSLIFY 1\nattribute 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 shader | ||
"#define GLSLIFY 1\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nuniform vec2 center;\nuniform vec3 params; // 10.0, 0.8, 0.1\nuniform float time;\n\nvoid main()\n{\n vec2 uv = vTextureCoord;\n vec2 texCoord = uv;\n\n float dist = distance(uv, 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 texCoord = uv + (diffUV * diffTime);\n }\n\n gl_FragColor = texture2D(uSampler, texCoord);\n}\n", | ||
// custom uniforms | ||
{ | ||
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 } | ||
} | ||
); | ||
this.center = [0.5, 0.5]; | ||
this.params = [10, 0.8, 0.1]; | ||
this.time = 0; | ||
} | ||
ShockwaveFilter.prototype = Object.create(PIXI.Filter.prototype); | ||
ShockwaveFilter.prototype.constructor = ShockwaveFilter; | ||
module.exports = ShockwaveFilter; | ||
Object.defineProperties(ShockwaveFilter.prototype, { | ||
/** | ||
* 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 {object<string, number>} | ||
* @memberof PIXI.filters.ShockwaveFilter# | ||
*/ | ||
center: { | ||
get: function () | ||
{ | ||
return this.uniforms.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 {object<string, number>} | ||
* @memberof PIXI.filters.ShockwaveFilter# | ||
*/ | ||
params: { | ||
get: function () | ||
{ | ||
return this.uniforms.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} | ||
* @memberof PIXI.filters.ShockwaveFilter# | ||
*/ | ||
time: { | ||
get: function () | ||
{ | ||
return this.uniforms.time; | ||
}, | ||
set: function (value) | ||
{ | ||
this.uniforms.time = value; | ||
} | ||
} | ||
}); | ||
},{}],3:[function(require,module,exports){ | ||
require("../check");var filter=PIXI.filters.ShockwaveFilter=require("./ShockwaveFilter");"undefined"!=typeof module&&module.exports&&(module.exports=filter); | ||
require('../check'); | ||
var filter = PIXI.filters.ShockwaveFilter = require('./ShockwaveFilter'); | ||
// Export for requiring | ||
if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = filter; | ||
} | ||
},{"../check":1,"./ShockwaveFilter":2}]},{},[3])(3) | ||
}); | ||
}); | ||
//# sourceMappingURL=shockwave.js.map |
@@ -0,14 +1,340 @@ | ||
/*! | ||
* pixi-filters - v1.0.3 | ||
* Compiled Mon Aug 08 2016 19:11:19 GMT-0400 (EDT) | ||
* | ||
* pixi-filters is licensed under the MIT License. | ||
* http://www.opensource.org/licenses/mit-license | ||
*/ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.tiltshift = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
if("undefined"==typeof PIXI)throw new Error("pixi.js is required to be included"); | ||
// Make sure PIXI global object is available | ||
if (typeof PIXI === "undefined") { | ||
throw new Error('pixi.js is required to be included'); | ||
} | ||
},{}],2:[function(require,module,exports){ | ||
function TiltShiftAxisFilter(){PIXI.Filter.call(this,"#define GLSLIFY 1\nattribute 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}","#define GLSLIFY 1\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float blur;\nuniform float gradientBlur;\nuniform vec2 start;\nuniform vec2 end;\nuniform vec2 delta;\nuniform vec2 texSize;\n\nfloat random(vec3 scale, float seed)\n{\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));\n float radius = smoothstep(0.0, 1.0, abs(dot(vTextureCoord * texSize - start, normal)) / gradientBlur) * blur;\n\n for (float t = -30.0; t <= 30.0; t++)\n {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 sample = texture2D(uSampler, vTextureCoord + delta / texSize * percent * radius);\n sample.rgb *= sample.a;\n color += sample * weight;\n total += weight;\n }\n\n gl_FragColor = color / total;\n gl_FragColor.rgb /= gl_FragColor.a + 0.00001;\n}\n"),this.uniforms.blur=100,this.uniforms.gradientBlur=600,this.uniforms.start=new PIXI.Point(0,window.innerHeight/2),this.uniforms.end=new PIXI.Point(600,window.innerHeight/2),this.uniforms.delta=new PIXI.Point(30,30),this.uniforms.texSize=new PIXI.Point(window.innerWidth,window.innerHeight),this.updateDelta()}TiltShiftAxisFilter.prototype=Object.create(PIXI.Filter.prototype),TiltShiftAxisFilter.prototype.constructor=TiltShiftAxisFilter,module.exports=TiltShiftAxisFilter,TiltShiftAxisFilter.prototype.updateDelta=function(){this.uniforms.delta.x=0,this.uniforms.delta.y=0},Object.defineProperties(TiltShiftAxisFilter.prototype,{blur:{get:function(){return this.uniforms.blur},set:function(t){this.uniforms.blur=t}},gradientBlur:{get:function(){return this.uniforms.gradientBlur},set:function(t){this.uniforms.gradientBlur=t}},start:{get:function(){return this.uniforms.start},set:function(t){this.uniforms.start=t,this.updateDelta()}},end:{get:function(){return this.uniforms.end},set:function(t){this.uniforms.end=t,this.updateDelta()}}}); | ||
/** | ||
* @author Vico @vicocotea | ||
* original filter https://github.com/evanw/glfx.js/blob/master/src/filters/blur/tiltshift.js by Evan Wallace : http://madebyevan.com/ | ||
*/ | ||
/** | ||
* A TiltShiftAxisFilter. | ||
* | ||
* @class | ||
* @extends PIXI.Filter | ||
* @memberof PIXI.filters | ||
*/ | ||
function TiltShiftAxisFilter() | ||
{ | ||
PIXI.Filter.call(this, | ||
// vertex shader | ||
"#define GLSLIFY 1\nattribute 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 shader | ||
"#define GLSLIFY 1\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float blur;\nuniform float gradientBlur;\nuniform vec2 start;\nuniform vec2 end;\nuniform vec2 delta;\nuniform vec2 texSize;\n\nfloat random(vec3 scale, float seed)\n{\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));\n float radius = smoothstep(0.0, 1.0, abs(dot(vTextureCoord * texSize - start, normal)) / gradientBlur) * blur;\n\n for (float t = -30.0; t <= 30.0; t++)\n {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 sample = texture2D(uSampler, vTextureCoord + delta / texSize * percent * radius);\n sample.rgb *= sample.a;\n color += sample * weight;\n total += weight;\n }\n\n gl_FragColor = color / total;\n gl_FragColor.rgb /= gl_FragColor.a + 0.00001;\n}\n" | ||
); | ||
this.uniforms.blur = 100; | ||
this.uniforms.gradientBlur = 600; | ||
this.uniforms.start = new PIXI.Point(0, window.innerHeight / 2); | ||
this.uniforms.end = new PIXI.Point(600, window.innerHeight / 2); | ||
this.uniforms.delta = new PIXI.Point(30, 30); | ||
this.uniforms.texSize = new PIXI.Point(window.innerWidth, window.innerHeight); | ||
this.updateDelta(); | ||
} | ||
TiltShiftAxisFilter.prototype = Object.create(PIXI.Filter.prototype); | ||
TiltShiftAxisFilter.prototype.constructor = TiltShiftAxisFilter; | ||
module.exports = TiltShiftAxisFilter; | ||
/** | ||
* Updates the filter delta values. | ||
* This is overridden in the X and Y filters, does nothing for this class. | ||
* | ||
*/ | ||
TiltShiftAxisFilter.prototype.updateDelta = function () | ||
{ | ||
this.uniforms.delta.x = 0; | ||
this.uniforms.delta.y = 0; | ||
}; | ||
Object.defineProperties(TiltShiftAxisFilter.prototype, { | ||
/** | ||
* The strength of the blur. | ||
* | ||
* @member {number} | ||
* @memberof PIXI.filters.TiltShiftAxisFilter# | ||
*/ | ||
blur: { | ||
get: function () | ||
{ | ||
return this.uniforms.blur; | ||
}, | ||
set: function (value) | ||
{ | ||
this.uniforms.blur = value; | ||
} | ||
}, | ||
/** | ||
* The strength of the gradient blur. | ||
* | ||
* @member {number} | ||
* @memberof PIXI.filters.TiltShiftAxisFilter# | ||
*/ | ||
gradientBlur: { | ||
get: function () | ||
{ | ||
return this.uniforms.gradientBlur; | ||
}, | ||
set: function (value) | ||
{ | ||
this.uniforms.gradientBlur = value; | ||
} | ||
}, | ||
/** | ||
* The X value to start the effect at. | ||
* | ||
* @member {PIXI.Point} | ||
* @memberof PIXI.filters.TiltShiftAxisFilter# | ||
*/ | ||
start: { | ||
get: function () | ||
{ | ||
return this.uniforms.start; | ||
}, | ||
set: function (value) | ||
{ | ||
this.uniforms.start = value; | ||
this.updateDelta(); | ||
} | ||
}, | ||
/** | ||
* The X value to end the effect at. | ||
* | ||
* @member {PIXI.Point} | ||
* @memberof PIXI.filters.TiltShiftAxisFilter# | ||
*/ | ||
end: { | ||
get: function () | ||
{ | ||
return this.uniforms.end; | ||
}, | ||
set: function (value) | ||
{ | ||
this.uniforms.end = value; | ||
this.updateDelta(); | ||
} | ||
} | ||
}); | ||
},{}],3:[function(require,module,exports){ | ||
function TiltShiftFilter(){PIXI.Filter.call(this),this.tiltShiftXFilter=new TiltShiftXFilter,this.tiltShiftYFilter=new TiltShiftYFilter}var TiltShiftXFilter=require("./TiltShiftXFilter"),TiltShiftYFilter=require("./TiltShiftYFilter");TiltShiftFilter.prototype=Object.create(PIXI.Filter.prototype),TiltShiftFilter.prototype.constructor=TiltShiftFilter,module.exports=TiltShiftFilter,TiltShiftFilter.prototype.apply=function(t,i,e){var r=t.getRenderTarget(!0);this.tiltShiftXFilter.apply(t,i,r),this.tiltShiftYFilter.apply(t,r,e),t.returnRenderTarget(r)},Object.defineProperties(TiltShiftFilter.prototype,{blur:{get:function(){return this.tiltShiftXFilter.blur},set:function(t){this.tiltShiftXFilter.blur=this.tiltShiftYFilter.blur=t}},gradientBlur:{get:function(){return this.tiltShiftXFilter.gradientBlur},set:function(t){this.tiltShiftXFilter.gradientBlur=this.tiltShiftYFilter.gradientBlur=t}},start:{get:function(){return this.tiltShiftXFilter.start},set:function(t){this.tiltShiftXFilter.start=this.tiltShiftYFilter.start=t}},end:{get:function(){return this.tiltShiftXFilter.end},set:function(t){this.tiltShiftXFilter.end=this.tiltShiftYFilter.end=t}}}); | ||
var TiltShiftXFilter = require('./TiltShiftXFilter'), | ||
TiltShiftYFilter = require('./TiltShiftYFilter'); | ||
/** | ||
* @author Vico @vicocotea | ||
* original filter https://github.com/evanw/glfx.js/blob/master/src/filters/blur/tiltshift.js by Evan Wallace : http://madebyevan.com/ | ||
*/ | ||
/** | ||
* A TiltShift Filter. Manages the pass of both a TiltShiftXFilter and TiltShiftYFilter. | ||
* | ||
* @class | ||
* @extends PIXI.Filter | ||
* @memberof PIXI.filters | ||
*/ | ||
function TiltShiftFilter() | ||
{ | ||
PIXI.Filter.call(this); | ||
this.tiltShiftXFilter = new TiltShiftXFilter(); | ||
this.tiltShiftYFilter = new TiltShiftYFilter(); | ||
} | ||
TiltShiftFilter.prototype = Object.create(PIXI.Filter.prototype); | ||
TiltShiftFilter.prototype.constructor = TiltShiftFilter; | ||
module.exports = TiltShiftFilter; | ||
TiltShiftFilter.prototype.apply = function (filterManager, input, output) | ||
{ | ||
var renderTarget = filterManager.getRenderTarget(true); | ||
this.tiltShiftXFilter.apply(filterManager, input, renderTarget); | ||
this.tiltShiftYFilter.apply(filterManager, renderTarget, output); | ||
filterManager.returnRenderTarget(renderTarget); | ||
}; | ||
Object.defineProperties(TiltShiftFilter.prototype, { | ||
/** | ||
* The strength of the blur. | ||
* | ||
* @member {number} | ||
* @memberof PIXI.filters.TiltShiftFilter# | ||
*/ | ||
blur: { | ||
get: function () | ||
{ | ||
return this.tiltShiftXFilter.blur; | ||
}, | ||
set: function (value) | ||
{ | ||
this.tiltShiftXFilter.blur = this.tiltShiftYFilter.blur = value; | ||
} | ||
}, | ||
/** | ||
* The strength of the gradient blur. | ||
* | ||
* @member {number} | ||
* @memberof PIXI.filters.TiltShiftFilter# | ||
*/ | ||
gradientBlur: { | ||
get: function () | ||
{ | ||
return this.tiltShiftXFilter.gradientBlur; | ||
}, | ||
set: function (value) | ||
{ | ||
this.tiltShiftXFilter.gradientBlur = this.tiltShiftYFilter.gradientBlur = value; | ||
} | ||
}, | ||
/** | ||
* The Y value to start the effect at. | ||
* | ||
* @member {number} | ||
* @memberof PIXI.filters.TiltShiftFilter# | ||
*/ | ||
start: { | ||
get: function () | ||
{ | ||
return this.tiltShiftXFilter.start; | ||
}, | ||
set: function (value) | ||
{ | ||
this.tiltShiftXFilter.start = this.tiltShiftYFilter.start = value; | ||
} | ||
}, | ||
/** | ||
* The Y value to end the effect at. | ||
* | ||
* @member {number} | ||
* @memberof PIXI.filters.TiltShiftFilter# | ||
*/ | ||
end: { | ||
get: function () | ||
{ | ||
return this.tiltShiftXFilter.end; | ||
}, | ||
set: function (value) | ||
{ | ||
this.tiltShiftXFilter.end = this.tiltShiftYFilter.end = value; | ||
} | ||
} | ||
}); | ||
},{"./TiltShiftXFilter":4,"./TiltShiftYFilter":5}],4:[function(require,module,exports){ | ||
function TiltShiftXFilter(){TiltShiftAxisFilter.call(this)}var TiltShiftAxisFilter=require("./TiltShiftAxisFilter");TiltShiftXFilter.prototype=Object.create(TiltShiftAxisFilter.prototype),TiltShiftXFilter.prototype.constructor=TiltShiftXFilter,module.exports=TiltShiftXFilter,TiltShiftXFilter.prototype.updateDelta=function(){var t=this.uniforms.end.x-this.uniforms.start.x,i=this.uniforms.end.y-this.uniforms.start.y,r=Math.sqrt(t*t+i*i);this.uniforms.delta.x=t/r,this.uniforms.delta.y=i/r}; | ||
var TiltShiftAxisFilter = require('./TiltShiftAxisFilter'); | ||
/** | ||
* @author Vico @vicocotea | ||
* original filter https://github.com/evanw/glfx.js/blob/master/src/filters/blur/tiltshift.js by Evan Wallace : http://madebyevan.com/ | ||
*/ | ||
/** | ||
* A TiltShiftXFilter. | ||
* | ||
* @class | ||
* @extends PIXI.TiltShiftAxisFilter | ||
* @memberof PIXI.filters | ||
*/ | ||
function TiltShiftXFilter() | ||
{ | ||
TiltShiftAxisFilter.call(this); | ||
} | ||
TiltShiftXFilter.prototype = Object.create(TiltShiftAxisFilter.prototype); | ||
TiltShiftXFilter.prototype.constructor = TiltShiftXFilter; | ||
module.exports = TiltShiftXFilter; | ||
/** | ||
* Updates the filter delta values. | ||
* | ||
*/ | ||
TiltShiftXFilter.prototype.updateDelta = function () | ||
{ | ||
var dx = this.uniforms.end.x - this.uniforms.start.x; | ||
var dy = this.uniforms.end.y - this.uniforms.start.y; | ||
var d = Math.sqrt(dx * dx + dy * dy); | ||
this.uniforms.delta.x = dx / d; | ||
this.uniforms.delta.y = dy / d; | ||
}; | ||
},{"./TiltShiftAxisFilter":2}],5:[function(require,module,exports){ | ||
function TiltShiftYFilter(){TiltShiftAxisFilter.call(this)}var TiltShiftAxisFilter=require("./TiltShiftAxisFilter");TiltShiftYFilter.prototype=Object.create(TiltShiftAxisFilter.prototype),TiltShiftYFilter.prototype.constructor=TiltShiftYFilter,module.exports=TiltShiftYFilter,TiltShiftYFilter.prototype.updateDelta=function(){var t=this.uniforms.end.x-this.uniforms.start.x,i=this.uniforms.end.y-this.uniforms.start.y,r=Math.sqrt(t*t+i*i);this.uniforms.delta.x=-i/r,this.uniforms.delta.y=t/r}; | ||
var TiltShiftAxisFilter = require('./TiltShiftAxisFilter'); | ||
/** | ||
* @author Vico @vicocotea | ||
* original filter https://github.com/evanw/glfx.js/blob/master/src/filters/blur/tiltshift.js by Evan Wallace : http://madebyevan.com/ | ||
*/ | ||
/** | ||
* A TiltShiftYFilter. | ||
* | ||
* @class | ||
* @extends PIXI.TiltShiftAxisFilter | ||
* @memberof PIXI.filters | ||
*/ | ||
function TiltShiftYFilter() | ||
{ | ||
TiltShiftAxisFilter.call(this); | ||
} | ||
TiltShiftYFilter.prototype = Object.create(TiltShiftAxisFilter.prototype); | ||
TiltShiftYFilter.prototype.constructor = TiltShiftYFilter; | ||
module.exports = TiltShiftYFilter; | ||
/** | ||
* Updates the filter delta values. | ||
* | ||
*/ | ||
TiltShiftYFilter.prototype.updateDelta = function () | ||
{ | ||
var dx = this.uniforms.end.x - this.uniforms.start.x; | ||
var dy = this.uniforms.end.y - this.uniforms.start.y; | ||
var d = Math.sqrt(dx * dx + dy * dy); | ||
this.uniforms.delta.x = -dy / d; | ||
this.uniforms.delta.y = dx / d; | ||
}; | ||
},{"./TiltShiftAxisFilter":2}],6:[function(require,module,exports){ | ||
require("../check");var filters={TiltShiftFilter:require("./TiltShiftFilter"),TiltShiftXFilter:require("./TiltShiftFilter"),TiltShiftYFilter:require("./TiltShiftFilter"),TiltShiftAxisFilter:require("./TiltShiftAxisFilter")};Object.assign(PIXI.filters,filters),"undefined"!=typeof module&&module.exports&&(module.exports=filters); | ||
require('../check'); | ||
var filters = { | ||
TiltShiftFilter: require('./TiltShiftFilter'), | ||
TiltShiftXFilter: require('./TiltShiftFilter'), | ||
TiltShiftYFilter: require('./TiltShiftFilter'), | ||
TiltShiftAxisFilter: require('./TiltShiftAxisFilter') | ||
}; | ||
Object.assign(PIXI.filters, filters); | ||
// Export for requiring | ||
if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = filters; | ||
} | ||
},{"../check":1,"./TiltShiftAxisFilter":2,"./TiltShiftFilter":3}]},{},[6])(6) | ||
}); | ||
}); | ||
//# sourceMappingURL=tiltshift.js.map |
107
bin/twist.js
@@ -0,8 +1,107 @@ | ||
/*! | ||
* pixi-filters - v1.0.3 | ||
* Compiled Mon Aug 08 2016 19:11:21 GMT-0400 (EDT) | ||
* | ||
* pixi-filters is licensed under the MIT License. | ||
* http://www.opensource.org/licenses/mit-license | ||
*/ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.twist = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
if("undefined"==typeof PIXI)throw new Error("pixi.js is required to be included"); | ||
// Make sure PIXI global object is available | ||
if (typeof PIXI === "undefined") { | ||
throw new Error('pixi.js is required to be included'); | ||
} | ||
},{}],2:[function(require,module,exports){ | ||
function TwistFilter(){PIXI.Filter.call(this,"#define GLSLIFY 1\nattribute 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}","#define GLSLIFY 1\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float radius;\nuniform float angle;\nuniform vec2 offset;\nuniform vec4 filterArea;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 twist(vec2 coord)\n{\n coord -= offset;\n\n float dist = length(coord);\n\n if (dist < radius)\n {\n float ratioDist = (radius - dist) / radius;\n float angleMod = ratioDist * ratioDist * angle;\n float s = sin(angleMod);\n float c = cos(angleMod);\n coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);\n }\n\n coord += offset;\n\n return coord;\n}\n\nvoid main(void)\n{\n\n vec2 coord = mapCoord(vTextureCoord);\n\n coord = twist(coord);\n\n coord = unmapCoord(coord);\n\n gl_FragColor = texture2D(uSampler, coord );\n\n}\n"),this.radius=200,this.angle=4,this.padding=20}TwistFilter.prototype=Object.create(PIXI.Filter.prototype),TwistFilter.prototype.constructor=TwistFilter,module.exports=TwistFilter,Object.defineProperties(TwistFilter.prototype,{offset:{get:function(){return this.uniforms.offset},set:function(o){this.uniforms.offset=o}},radius:{get:function(){return this.uniforms.radius},set:function(o){this.uniforms.radius=o}},angle:{get:function(){return this.uniforms.angle},set:function(o){this.uniforms.angle=o}}}); | ||
/** | ||
* This filter applies a twist effect making display objects appear twisted in the given direction. | ||
* | ||
* @class | ||
* @extends PIXI.Filter | ||
* @memberof PIXI.filters | ||
*/ | ||
function TwistFilter() | ||
{ | ||
PIXI.Filter.call(this, | ||
// vertex shader | ||
"#define GLSLIFY 1\nattribute 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 shader | ||
"#define GLSLIFY 1\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float radius;\nuniform float angle;\nuniform vec2 offset;\nuniform vec4 filterArea;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 twist(vec2 coord)\n{\n coord -= offset;\n\n float dist = length(coord);\n\n if (dist < radius)\n {\n float ratioDist = (radius - dist) / radius;\n float angleMod = ratioDist * ratioDist * angle;\n float s = sin(angleMod);\n float c = cos(angleMod);\n coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);\n }\n\n coord += offset;\n\n return coord;\n}\n\nvoid main(void)\n{\n\n vec2 coord = mapCoord(vTextureCoord);\n\n coord = twist(coord);\n\n coord = unmapCoord(coord);\n\n gl_FragColor = texture2D(uSampler, coord );\n\n}\n" | ||
); | ||
this.radius = 200; | ||
this.angle = 4; | ||
this.padding = 20; | ||
} | ||
TwistFilter.prototype = Object.create(PIXI.Filter.prototype); | ||
TwistFilter.prototype.constructor = TwistFilter; | ||
module.exports = TwistFilter; | ||
Object.defineProperties(TwistFilter.prototype, { | ||
/** | ||
* This point describes the the offset of the twist. | ||
* | ||
* @member {PIXI.Point} | ||
* @memberof PIXI.filters.TwistFilter# | ||
*/ | ||
offset: { | ||
get: function () | ||
{ | ||
return this.uniforms.offset; | ||
}, | ||
set: function (value) | ||
{ | ||
this.uniforms.offset = value; | ||
} | ||
}, | ||
/** | ||
* This radius of the twist. | ||
* | ||
* @member {number} | ||
* @memberof PIXI.filters.TwistFilter# | ||
*/ | ||
radius: { | ||
get: function () | ||
{ | ||
return this.uniforms.radius; | ||
}, | ||
set: function (value) | ||
{ | ||
this.uniforms.radius = value; | ||
} | ||
}, | ||
/** | ||
* This angle of the twist. | ||
* | ||
* @member {number} | ||
* @memberof PIXI.filters.TwistFilter# | ||
*/ | ||
angle: { | ||
get: function () | ||
{ | ||
return this.uniforms.angle; | ||
}, | ||
set: function (value) | ||
{ | ||
this.uniforms.angle = value; | ||
} | ||
} | ||
}); | ||
},{}],3:[function(require,module,exports){ | ||
require("../check");var filter=PIXI.filters.TwistFilter=require("./TwistFilter");"undefined"!=typeof module&&module.exports&&(module.exports=filter); | ||
require('../check'); | ||
var filter = PIXI.filters.TwistFilter = require('./TwistFilter'); | ||
// Export for requiring | ||
if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = filter; | ||
} | ||
},{"../check":1,"./TwistFilter":2}]},{},[3])(3) | ||
}); | ||
}); | ||
//# sourceMappingURL=twist.js.map |
{ | ||
"name": "pixi-filters", | ||
"version": "1.0.0", | ||
"version": "1.0.3", | ||
"description": "Optional display filters to work with Pixi.js", | ||
"author": "Mat Groves", | ||
"main": "bin/pixi-filters.js", | ||
"main": "bin/pixi-filters.min.js", | ||
"homepage": "http://goodboydigital.com/", | ||
@@ -16,17 +16,19 @@ "bugs": "https://github.com/pixijs/pixi-filters/issues", | ||
"predeploy": "npm run build", | ||
"test": "npm run build", | ||
"postversion": "git push && git push --tags", | ||
"deploy": "node scripts/deploy.js", | ||
"clean": "rimraf bin && mkdir bin", | ||
"clean": "rimraf bin && mkdirp bin", | ||
"lint": "eslint src/**/*.js", | ||
"build:ascii": "browserify src/ascii -s ascii -o bin/ascii.js --no-bundle-external", | ||
"build:bloom": "browserify src/bloom -s bloom -o bin/bloom.js --no-bundle-external", | ||
"build:convolution": "browserify src/convolution -s convolution -o bin/convolution.js --no-bundle-external", | ||
"build:crosshatch": "browserify src/crosshatch -s crosshatch -o bin/crosshatch.js --no-bundle-external", | ||
"build:dot": "browserify src/dot -s dot -o bin/dot.js --no-bundle-external", | ||
"build:emboss": "browserify src/emboss -s emboss -o bin/emboss.js --no-bundle-external", | ||
"build:pixelate": "browserify src/pixelate -s pixelate -o bin/pixelate.js --no-bundle-external", | ||
"build:rgb": "browserify src/rgb -s rgb -o bin/rgb.js --no-bundle-external", | ||
"build:shockwave": "browserify src/shockwave -s shockwave -o bin/shockwave.js --no-bundle-external", | ||
"build:tiltshift": "browserify src/tiltshift -s tiltshift -o bin/tiltshift.js --no-bundle-external", | ||
"build:twist": "browserify src/twist -s twist -o bin/twist.js --no-bundle-external", | ||
"build:all": "browserify src -s filters -o bin/pixi-filters.js --no-bundle-external", | ||
"build:ascii": "pixify -s src/ascii -n ascii", | ||
"build:bloom": "pixify -s src/bloom -n bloom", | ||
"build:convolution": "pixify -s src/convolution -n convolution", | ||
"build:crosshatch": "pixify -s src/crosshatch -n crosshatch", | ||
"build:dot": "pixify -s src/dot -n dot", | ||
"build:emboss": "pixify -s src/emboss -n emboss", | ||
"build:pixelate": "pixify -s src/pixelate -n pixelate", | ||
"build:rgb": "pixify -s src/rgb -n rgb", | ||
"build:shockwave": "pixify -s src/shockwave -n shockwave", | ||
"build:tiltshift": "pixify -s src/tiltshift -n tiltshift", | ||
"build:twist": "pixify -s src/twist -n twist", | ||
"build:all": "pixify -s src -n filters", | ||
"prebuild": "npm run clean && npm run lint", | ||
@@ -37,13 +39,12 @@ "start": "watchify src/index.js -s filters -o bin/pixi-filters.js --no-bundle-external -dv", | ||
"devDependencies": { | ||
"browserify": "^13.0.1", | ||
"eslint": "^3.1.1", | ||
"gh-pages": "^0.11.0", | ||
"glslify": "^5.1.0", | ||
"rimraf": "^2.5.3", | ||
"uglifyify": "^3.0.2" | ||
"mkdirp": "^0.5.1", | ||
"pixify": "^1.2.0", | ||
"rimraf": "^2.5.3" | ||
}, | ||
"browserify": { | ||
"transform": [ | ||
"glslify", | ||
"uglifyify" | ||
"glslify" | ||
] | ||
@@ -50,0 +51,0 @@ }, |
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
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
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 2 instances in 1 package
359558
51
2419
60
1