diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index 7401020..1a8afa2 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -209,7 +209,7 @@ if(this._useFXAA) { - window.console.warn("FXAA antialiasing being used instead of native antialiasing") + window.console.warn('FXAA antialiasing being used instead of native antialiasing'); this._FXAAFilter = [new FXAAFilter()]; } }; @@ -340,7 +340,7 @@ // console.log(width) this.filterManager.resize(width, height); this.renderTarget.resize(width, height); - if(this.currentRenderTarget == this.renderTarget) + if(this.currentRenderTarget === this.renderTarget) { this.renderTarget.activate(); } diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index 7401020..1a8afa2 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -209,7 +209,7 @@ if(this._useFXAA) { - window.console.warn("FXAA antialiasing being used instead of native antialiasing") + window.console.warn('FXAA antialiasing being used instead of native antialiasing'); this._FXAAFilter = [new FXAAFilter()]; } }; @@ -340,7 +340,7 @@ // console.log(width) this.filterManager.resize(width, height); this.renderTarget.resize(width, height); - if(this.currentRenderTarget == this.renderTarget) + if(this.currentRenderTarget === this.renderTarget) { this.renderTarget.activate(); } diff --git a/src/core/utils/index.js b/src/core/utils/index.js index 7339b24..beba393 100644 --- a/src/core/utils/index.js +++ b/src/core/utils/index.js @@ -72,7 +72,10 @@ */ canUseNewCanvasBlendModes: function () { - if (typeof document === 'undefined') return false; + if (typeof document === 'undefined') + { + return false; + } var pngHead = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/'; var pngEnd = 'AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg=='; diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index 7401020..1a8afa2 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -209,7 +209,7 @@ if(this._useFXAA) { - window.console.warn("FXAA antialiasing being used instead of native antialiasing") + window.console.warn('FXAA antialiasing being used instead of native antialiasing'); this._FXAAFilter = [new FXAAFilter()]; } }; @@ -340,7 +340,7 @@ // console.log(width) this.filterManager.resize(width, height); this.renderTarget.resize(width, height); - if(this.currentRenderTarget == this.renderTarget) + if(this.currentRenderTarget === this.renderTarget) { this.renderTarget.activate(); } diff --git a/src/core/utils/index.js b/src/core/utils/index.js index 7339b24..beba393 100644 --- a/src/core/utils/index.js +++ b/src/core/utils/index.js @@ -72,7 +72,10 @@ */ canUseNewCanvasBlendModes: function () { - if (typeof document === 'undefined') return false; + if (typeof document === 'undefined') + { + return false; + } var pngHead = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/'; var pngEnd = 'AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg=='; diff --git a/src/deprecation.js b/src/deprecation.js index d62336f..c292133 100644 --- a/src/deprecation.js +++ b/src/deprecation.js @@ -4,45 +4,45 @@ core.Stage = function () { - window.console.warn("You don't need to use a PIXI Stage any more, you can simply render any container."); + window.console.warn('You do not need to use a PIXI Stage any more, you can simply render any container.'); return new core.Container(); }; core.SpriteBatch = function () { - window.console.warn("SpriteBatch doesn't exist any more, please use the new ParticleContainer instead."); + window.console.warn('SpriteBatch does not exist any more, please use the new ParticleContainer instead.'); }; core.AssetsLoader = function () { - window.console.warn("The loader system was overhauled in pixi v3, please see the new PIXI.Loader class."); + window.console.warn('The loader system was overhauled in pixi v3, please see the new PIXI.Loader class.'); }; core.DisplayObjectContainer = function () { - window.console.warn("DisplayObjectContainer has been shortened to Container, please use Container from now on"); + window.console.warn('DisplayObjectContainer has been shortened to Container, please use Container from now on'); return new core.Container(); }; core.Strip = function (texture) { - window.console.warn("The Strip class has been renamed to Mesh, please use Mesh from now on"); + window.console.warn('The Strip class has been renamed to Mesh, please use Mesh from now on'); return new extras.mesh.Mesh(texture); }; core.Sprite.prototype.setTexture = function (texture) { this.texture = texture; - window.console.warn("setTexture is now deprecated, please use the texture property, e.g : sprite.texture = texture;"); + window.console.warn('setTexture is now deprecated, please use the texture property, e.g : sprite.texture = texture;'); }; text.BitmapText.prototype.setText = function (text) { this.text = text; - window.console.warn("setText is now deprecated, please use the text property, e.g : myBitmapText.text = 'my text';"); + window.console.warn('setText is now deprecated, please use the text property, e.g : myBitmapText.text = \'my text\';'); }; text.Text.prototype.setText = function (text) { this.text = text; - window.console.warn("setText is now deprecated, please use the text property, e.g : myText.text = 'my text';"); + window.console.warn('setText is now deprecated, please use the text property, e.g : myText.text = \'my text\';'); }; module.exports = {}; diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index 7401020..1a8afa2 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -209,7 +209,7 @@ if(this._useFXAA) { - window.console.warn("FXAA antialiasing being used instead of native antialiasing") + window.console.warn('FXAA antialiasing being used instead of native antialiasing'); this._FXAAFilter = [new FXAAFilter()]; } }; @@ -340,7 +340,7 @@ // console.log(width) this.filterManager.resize(width, height); this.renderTarget.resize(width, height); - if(this.currentRenderTarget == this.renderTarget) + if(this.currentRenderTarget === this.renderTarget) { this.renderTarget.activate(); } diff --git a/src/core/utils/index.js b/src/core/utils/index.js index 7339b24..beba393 100644 --- a/src/core/utils/index.js +++ b/src/core/utils/index.js @@ -72,7 +72,10 @@ */ canUseNewCanvasBlendModes: function () { - if (typeof document === 'undefined') return false; + if (typeof document === 'undefined') + { + return false; + } var pngHead = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/'; var pngEnd = 'AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg=='; diff --git a/src/deprecation.js b/src/deprecation.js index d62336f..c292133 100644 --- a/src/deprecation.js +++ b/src/deprecation.js @@ -4,45 +4,45 @@ core.Stage = function () { - window.console.warn("You don't need to use a PIXI Stage any more, you can simply render any container."); + window.console.warn('You do not need to use a PIXI Stage any more, you can simply render any container.'); return new core.Container(); }; core.SpriteBatch = function () { - window.console.warn("SpriteBatch doesn't exist any more, please use the new ParticleContainer instead."); + window.console.warn('SpriteBatch does not exist any more, please use the new ParticleContainer instead.'); }; core.AssetsLoader = function () { - window.console.warn("The loader system was overhauled in pixi v3, please see the new PIXI.Loader class."); + window.console.warn('The loader system was overhauled in pixi v3, please see the new PIXI.Loader class.'); }; core.DisplayObjectContainer = function () { - window.console.warn("DisplayObjectContainer has been shortened to Container, please use Container from now on"); + window.console.warn('DisplayObjectContainer has been shortened to Container, please use Container from now on'); return new core.Container(); }; core.Strip = function (texture) { - window.console.warn("The Strip class has been renamed to Mesh, please use Mesh from now on"); + window.console.warn('The Strip class has been renamed to Mesh, please use Mesh from now on'); return new extras.mesh.Mesh(texture); }; core.Sprite.prototype.setTexture = function (texture) { this.texture = texture; - window.console.warn("setTexture is now deprecated, please use the texture property, e.g : sprite.texture = texture;"); + window.console.warn('setTexture is now deprecated, please use the texture property, e.g : sprite.texture = texture;'); }; text.BitmapText.prototype.setText = function (text) { this.text = text; - window.console.warn("setText is now deprecated, please use the text property, e.g : myBitmapText.text = 'my text';"); + window.console.warn('setText is now deprecated, please use the text property, e.g : myBitmapText.text = \'my text\';'); }; text.Text.prototype.setText = function (text) { this.text = text; - window.console.warn("setText is now deprecated, please use the text property, e.g : myText.text = 'my text';"); + window.console.warn('setText is now deprecated, please use the text property, e.g : myText.text = \'my text\';'); }; module.exports = {}; diff --git a/src/extras/TilingSprite.js b/src/extras/TilingSprite.js index 849cf78..e0e3e5d 100644 --- a/src/extras/TilingSprite.js +++ b/src/extras/TilingSprite.js @@ -210,8 +210,6 @@ var transform = this.worldTransform; - var i,j; - var resolution = renderer.resolution; context.setTransform(transform.a * resolution, @@ -477,7 +475,7 @@ */ TilingSprite.fromFrame = function (frameId,width,height) { - var texture = utils.TextureCache[frameId]; + var texture = core.utils.TextureCache[frameId]; if (!texture) { @@ -501,5 +499,5 @@ */ TilingSprite.fromImage = function (imageId, width, height, crossorigin, scaleMode) { - return new TilingSprite(Texture.fromImage(imageId, crossorigin, scaleMode),width,height); + return new TilingSprite(core.Texture.fromImage(imageId, crossorigin, scaleMode),width,height); }; diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index 7401020..1a8afa2 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -209,7 +209,7 @@ if(this._useFXAA) { - window.console.warn("FXAA antialiasing being used instead of native antialiasing") + window.console.warn('FXAA antialiasing being used instead of native antialiasing'); this._FXAAFilter = [new FXAAFilter()]; } }; @@ -340,7 +340,7 @@ // console.log(width) this.filterManager.resize(width, height); this.renderTarget.resize(width, height); - if(this.currentRenderTarget == this.renderTarget) + if(this.currentRenderTarget === this.renderTarget) { this.renderTarget.activate(); } diff --git a/src/core/utils/index.js b/src/core/utils/index.js index 7339b24..beba393 100644 --- a/src/core/utils/index.js +++ b/src/core/utils/index.js @@ -72,7 +72,10 @@ */ canUseNewCanvasBlendModes: function () { - if (typeof document === 'undefined') return false; + if (typeof document === 'undefined') + { + return false; + } var pngHead = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/'; var pngEnd = 'AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg=='; diff --git a/src/deprecation.js b/src/deprecation.js index d62336f..c292133 100644 --- a/src/deprecation.js +++ b/src/deprecation.js @@ -4,45 +4,45 @@ core.Stage = function () { - window.console.warn("You don't need to use a PIXI Stage any more, you can simply render any container."); + window.console.warn('You do not need to use a PIXI Stage any more, you can simply render any container.'); return new core.Container(); }; core.SpriteBatch = function () { - window.console.warn("SpriteBatch doesn't exist any more, please use the new ParticleContainer instead."); + window.console.warn('SpriteBatch does not exist any more, please use the new ParticleContainer instead.'); }; core.AssetsLoader = function () { - window.console.warn("The loader system was overhauled in pixi v3, please see the new PIXI.Loader class."); + window.console.warn('The loader system was overhauled in pixi v3, please see the new PIXI.Loader class.'); }; core.DisplayObjectContainer = function () { - window.console.warn("DisplayObjectContainer has been shortened to Container, please use Container from now on"); + window.console.warn('DisplayObjectContainer has been shortened to Container, please use Container from now on'); return new core.Container(); }; core.Strip = function (texture) { - window.console.warn("The Strip class has been renamed to Mesh, please use Mesh from now on"); + window.console.warn('The Strip class has been renamed to Mesh, please use Mesh from now on'); return new extras.mesh.Mesh(texture); }; core.Sprite.prototype.setTexture = function (texture) { this.texture = texture; - window.console.warn("setTexture is now deprecated, please use the texture property, e.g : sprite.texture = texture;"); + window.console.warn('setTexture is now deprecated, please use the texture property, e.g : sprite.texture = texture;'); }; text.BitmapText.prototype.setText = function (text) { this.text = text; - window.console.warn("setText is now deprecated, please use the text property, e.g : myBitmapText.text = 'my text';"); + window.console.warn('setText is now deprecated, please use the text property, e.g : myBitmapText.text = \'my text\';'); }; text.Text.prototype.setText = function (text) { this.text = text; - window.console.warn("setText is now deprecated, please use the text property, e.g : myText.text = 'my text';"); + window.console.warn('setText is now deprecated, please use the text property, e.g : myText.text = \'my text\';'); }; module.exports = {}; diff --git a/src/extras/TilingSprite.js b/src/extras/TilingSprite.js index 849cf78..e0e3e5d 100644 --- a/src/extras/TilingSprite.js +++ b/src/extras/TilingSprite.js @@ -210,8 +210,6 @@ var transform = this.worldTransform; - var i,j; - var resolution = renderer.resolution; context.setTransform(transform.a * resolution, @@ -477,7 +475,7 @@ */ TilingSprite.fromFrame = function (frameId,width,height) { - var texture = utils.TextureCache[frameId]; + var texture = core.utils.TextureCache[frameId]; if (!texture) { @@ -501,5 +499,5 @@ */ TilingSprite.fromImage = function (imageId, width, height, crossorigin, scaleMode) { - return new TilingSprite(Texture.fromImage(imageId, crossorigin, scaleMode),width,height); + return new TilingSprite(core.Texture.fromImage(imageId, crossorigin, scaleMode),width,height); }; diff --git a/src/filters/color/ColorMatrixFilter.js b/src/filters/color/ColorMatrixFilter.js index 9277308..7f2cc76 100644 --- a/src/filters/color/ColorMatrixFilter.js +++ b/src/filters/color/ColorMatrixFilter.js @@ -40,24 +40,24 @@ /** * Transforms current matrix and set the new one - * + * * @param matrix {array} (mat 5x5) * @param multiply {boolean} if true, current matrix and matrix are multiplied. If false, just set the current matrix with @param matrix */ ColorMatrixFilter.prototype._loadMatrix = function(matrix, multiply) { - multiply = !!multiply; + multiply = !!multiply; - var newMatrix = matrix; + var newMatrix = matrix; - if(multiply) - { - this._multiply(newMatrix, this.uniforms.m.value, matrix); - newMatrix = this._colorMatrix(newMatrix) - } + if(multiply) + { + this._multiply(newMatrix, this.uniforms.m.value, matrix); + newMatrix = this._colorMatrix(newMatrix); + } - // set the new matrix - this.uniforms.m.value = newMatrix; + // set the new matrix + this.uniforms.m.value = newMatrix; }; /** @@ -104,17 +104,17 @@ out[22] = a[20]*b[2] + a[21]*b[7] + a[22]*b[12]+ a[23]*b[17]+a[24]*b[22]; out[23] = a[20]*b[3] + a[21]*b[8] + a[22]*b[13]+ a[23]*b[18]+a[24]*b[23]; out[24] = a[20]*b[4] + a[21]*b[9] + a[22]*b[14]+ a[23]*b[19]+a[24]*b[24]; - + return out; }; /** * Create a Float32 Array and normalize the offset component to 0-1 - * + * * @param matrix {array} (mat 5x5) * @return m { array } (mat 5x5) with all values between 0-1 */ -ColorMatrixFilter.prototype._colorMatrix = function( matrix ) +ColorMatrixFilter.prototype._colorMatrix = function( matrix ) { // Create a Float32 Array and normalize the offset component to 0-1 var m = new Float32Array(matrix); @@ -128,40 +128,43 @@ /** * Adjusts brightness - * + * * Multiply the current matrix * @param b {number} value of the brigthness (0 is black) * @param multiply {boolean} refer to ._loadMatrix() method */ ColorMatrixFilter.prototype.brightness = function(b, multiply) { - var matrix = - [b, 0, 0, 0, 0, - 0, b, 0, 0, 0, - 0, 0, b, 0, 0, - 0, 0, 0, 1, 0, - 0, 0, 0, 0, 1]; + var matrix = [ + b, 0, 0, 0, 0, + 0, b, 0, 0, 0, + 0, 0, b, 0, 0, + 0, 0, 0, 1, 0, + 0, 0, 0, 0, 1 + ]; - this._loadMatrix(matrix, multiply); + this._loadMatrix(matrix, multiply); }; /** * Set the matrices in grey scales - * + * * Multiply the current matrix * @param scale {number} value of the grey (0 is black) * @param multiply {boolean} refer to ._loadMatrix() method */ ColorMatrixFilter.prototype.greyscale = function(scale, multiply) { - var matrix = [ scale, scale, scale, 0, 0, - scale, scale, scale, 0, 0, - scale, scale, scale, 0, 0, - 0,0,0,1,0, - 0,0,0,0,1]; + var matrix = [ + scale, scale, scale, 0, 0, + scale, scale, scale, 0, 0, + scale, scale, scale, 0, 0, + 0,0,0,1,0, + 0,0,0,0,1 + ]; - this._loadMatrix(matrix, multiply); + this._loadMatrix(matrix, multiply); }; /** @@ -172,41 +175,41 @@ */ ColorMatrixFilter.prototype.blackAndWhite = function(multiply) { - var matrix = [ - 0.3, 0.6, 0.1, 0, 0, - 0.3, 0.6, 0.1, 0, 0, - 0.3, 0.6, 0.1, 0, 0, - 0, 0, 0, 1, 0, - 0, 0, 0, 0, 1 - ]; + var matrix = [ + 0.3, 0.6, 0.1, 0, 0, + 0.3, 0.6, 0.1, 0, 0, + 0.3, 0.6, 0.1, 0, 0, + 0, 0, 0, 1, 0, + 0, 0, 0, 0, 1 + ]; - this._loadMatrix(matrix, multiply); + this._loadMatrix(matrix, multiply); }; /** * Set the hue propertie of the color - * + * * Multiply the current matrix * @param rotation {number} in degrees * @param multiply {boolean} refer to ._loadMatrix() method */ ColorMatrixFilter.prototype.hue = function(rotation, multiply) { - rotation = (rotation || 0)/180 * Math.PI; - var cos = Math.cos(rotation), - sin = Math.sin(rotation); + rotation = (rotation || 0)/180 * Math.PI; + var cos = Math.cos(rotation), + sin = Math.sin(rotation); // luminanceRed, luminanceGreen, luminanceBlue - var lumR = 0.213, // or 0.3086 - lumG = 0.715, // or 0.6094 - lumB = 0.072; // or 0.0820 + var lumR = 0.213, // or 0.3086 + lumG = 0.715, // or 0.6094 + lumB = 0.072; // or 0.0820 - var matrix = [ - lumR+cos*(1-lumR)+sin*(-lumR), lumG+cos*(-lumG)+sin*(-lumG), lumB+cos*(-lumB)+sin*(1-lumB), 0, 0, - lumR+cos*(-lumR)+sin*(0.143), lumG+cos*(1-lumG)+sin*(0.140), lumB+cos*(-lumB)+sin*(-0.283), 0, 0, - lumR+cos*(-lumR)+sin*(-(1-lumR)), lumG+cos*(-lumG)+sin*(lumG), lumB+cos*(1-lumB)+sin*(lumB), 0, 0, - 0, 0, 0, 1, 0, - 0, 0, 0, 0, 1 + var matrix = [ + lumR+cos*(1-lumR)+sin*(-lumR), lumG+cos*(-lumG)+sin*(-lumG), lumB+cos*(-lumB)+sin*(1-lumB), 0, 0, + lumR+cos*(-lumR)+sin*(0.143), lumG+cos*(1-lumG)+sin*(0.140), lumB+cos*(-lumB)+sin*(-0.283), 0, 0, + lumR+cos*(-lumR)+sin*(-(1-lumR)), lumG+cos*(-lumG)+sin*(lumG), lumB+cos*(1-lumB)+sin*(lumB), 0, 0, + 0, 0, 0, 1, 0, + 0, 0, 0, 0, 1 ]; this._loadMatrix(matrix, multiply); @@ -223,17 +226,18 @@ */ ColorMatrixFilter.prototype.contrast = function(amount, multiply) { - var v = (amount || 0) + 1; - var o = -128 * (v-1); - - var matrix = [ - v, 0, 0, 0, o, - 0, v, 0, 0, o, - 0, 0, v, 0, o, - 0, 0, 0, 1, 0, - 0, 0, 0, 0, 1]; + var v = (amount || 0) + 1; + var o = -128 * (v-1); - this._loadMatrix(matrix, multiply); + var matrix = [ + v, 0, 0, 0, o, + 0, v, 0, 0, o, + 0, 0, v, 0, o, + 0, 0, 0, 1, 0, + 0, 0, 0, 0, 1 + ]; + + this._loadMatrix(matrix, multiply); }; /** @@ -244,16 +248,18 @@ */ ColorMatrixFilter.prototype.saturation = function(amount, multiply) { - var x = (amount || 0) * 2/3 + 1; - var y = ((x-1) *-0.5); + var x = (amount || 0) * 2/3 + 1; + var y = ((x-1) *-0.5); - var matrix = [ - x, y, y, 0, 0, - y, x, y, 0, 0, - y, y, x, 0, 0, - 0, 0, 0, 1, 0, - 0, 0, 0, 0, 1]; - this._loadMatrix(matrix, multiply); + var matrix = [ + x, y, y, 0, 0, + y, x, y, 0, 0, + y, y, x, 0, 0, + 0, 0, 0, 1, 0, + 0, 0, 0, 0, 1 + ]; + + this._loadMatrix(matrix, multiply); }; /** @@ -265,7 +271,7 @@ */ ColorMatrixFilter.prototype.desaturate = function(multiply) { - this.saturation(-1); + this.saturation(-1); }; /** @@ -275,15 +281,15 @@ */ ColorMatrixFilter.prototype.negative = function(multiply) { - var matrix = [ - 0, 1, 1, 0, 0, - 1, 0, 1, 0, 0, - 1, 1, 0, 0, 0, - 0, 0, 0, 1, 0, - 0, 0, 0, 0, 1 - ]; + var matrix = [ + 0, 1, 1, 0, 0, + 1, 0, 1, 0, 0, + 1, 1, 0, 0, 0, + 0, 0, 0, 1, 0, + 0, 0, 0, 0, 1 + ]; - this._loadMatrix(matrix, multiply); + this._loadMatrix(matrix, multiply); }; /** @@ -318,7 +324,7 @@ 0, 0, 0, 0, 0]; this._loadMatrix(matrix, multiply); -} +}; /** * Polaroid filter @@ -335,7 +341,7 @@ 0,0,0,0,1]; this._loadMatrix(matrix, multiply); -} +}; /** * Filter who transforms : Red -> Blue and Blue -> Red @@ -344,15 +350,15 @@ */ ColorMatrixFilter.prototype.toBGR = function(multiply) { - var matrix = [ - 0,0,1,0,0, - 0,1,0,0,0, - 1,0,0,0,0, - 0,0,0,1,0, - 0,0,0,0,1 - ]; + var matrix = [ + 0,0,1,0,0, + 0,1,0,0,0, + 1,0,0,0,0, + 0,0,0,1,0, + 0,0,0,0,1 + ]; - this._loadMatrix(matrix, multiply); + this._loadMatrix(matrix, multiply); }; /** @@ -362,16 +368,15 @@ */ ColorMatrixFilter.prototype.kodachrome = function(multiply) { - var matrix = [ - 1.1285582396593525,-0.3967382283601348,-0.03992559172921793,0,63.72958762196502, - -0.16404339962244616,1.0835251566291304,-0.05498805115633132,0,24.732407896706203, - -0.16786010706155763,-0.5603416277695248,1.6014850761964943,0,35.62982807460946, - 0,0,0,1,0, - 0,0,0,0,1 - ]; + var matrix = [ + 1.1285582396593525,-0.3967382283601348,-0.03992559172921793,0,63.72958762196502, + -0.16404339962244616,1.0835251566291304,-0.05498805115633132,0,24.732407896706203, + -0.16786010706155763,-0.5603416277695248,1.6014850761964943,0,35.62982807460946, + 0,0,0,1,0, + 0,0,0,0,1 + ]; - this._loadMatrix(matrix, multiply); - + this._loadMatrix(matrix, multiply); }; /** @@ -381,14 +386,15 @@ */ ColorMatrixFilter.prototype.browni = function(multiply) { - var matrix = [ - 0.5997023498159715,0.34553243048391263,-0.2708298674538042,0,47.43192855600873, - -0.037703249837783157,0.8609577587992641,0.15059552388459913,0,-36.96841498319127, - 0.24113635128153335,-0.07441037908422492,0.44972182064877153,0,-7.562075277591283, - 0,0,0,1,0, - 0,0,0,0,1]; + var matrix = [ + 0.5997023498159715,0.34553243048391263,-0.2708298674538042,0,47.43192855600873, + -0.037703249837783157,0.8609577587992641,0.15059552388459913,0,-36.96841498319127, + 0.24113635128153335,-0.07441037908422492,0.44972182064877153,0,-7.562075277591283, + 0,0,0,1,0, + 0,0,0,0,1 + ]; - this._loadMatrix(matrix, multiply); + this._loadMatrix(matrix, multiply); }; /* @@ -398,15 +404,15 @@ */ ColorMatrixFilter.prototype.vintage = function(multiply) { - var matrix = [ - 0.6279345635605994,0.3202183420819367,-0.03965408211312453,0,9.651285835294123, - 0.02578397704808868,0.6441188644374771,0.03259127616149294,0,7.462829176470591, - 0.0466055556782719,-0.0851232987247891,0.5241648018700465,0,5.159190588235296, - 0,0,0,1,0, - 0,0,0,0,1, - ]; + var matrix = [ + 0.6279345635605994,0.3202183420819367,-0.03965408211312453,0,9.651285835294123, + 0.02578397704808868,0.6441188644374771,0.03259127616149294,0,7.462829176470591, + 0.0466055556782719,-0.0851232987247891,0.5241648018700465,0,5.159190588235296, + 0,0,0,1,0, + 0,0,0,0,1, + ]; - this._loadMatrix(matrix, multiply); + this._loadMatrix(matrix, multiply); }; /* @@ -421,29 +427,28 @@ */ ColorMatrixFilter.prototype.colorTone = function(desaturation, toned, lightColor, darkColor, multiply) { - var desaturation = desaturation || 0.2, - toned = toned || 0.15, - lightColor = lightColor || 0xFFE580, + desaturation = desaturation || 0.2; + toned = toned || 0.15; + lightColor = lightColor || 0xFFE580; darkColor = darkColor || 0x338000; + var lR = ((lightColor >> 16) & 0xFF) / 255; + var lG = ((lightColor >> 8) & 0xFF) / 255; + var lB = (lightColor & 0xFF) / 255; - var lR = ((lightColor >> 16) & 0xFF) / 255; - var lG = ((lightColor >> 8) & 0xFF) / 255; - var lB = (lightColor & 0xFF) / 255; - - var dR = ((darkColor >> 16) & 0xFF) / 255; - var dG = ((darkColor >> 8) & 0xFF) / 255; - var dB = (darkColor & 0xFF) / 255; - - var matrix = [ - 0.3, 0.59, 0.11, 0, 0, - lR, lG, lB, desaturation, 0, - dR, dG, dB, toned, 0, - lR-dR, lG-dG, lB-dB, 0, 0, - 0, 0, 0, 0, 1 - ]; + var dR = ((darkColor >> 16) & 0xFF) / 255; + var dG = ((darkColor >> 8) & 0xFF) / 255; + var dB = (darkColor & 0xFF) / 255; - this._loadMatrix(matrix, multiply); + var matrix = [ + 0.3, 0.59, 0.11, 0, 0, + lR, lG, lB, desaturation, 0, + dR, dG, dB, toned, 0, + lR-dR, lG-dG, lB-dB, 0, 0, + 0, 0, 0, 0, 1 + ]; + + this._loadMatrix(matrix, multiply); }; /* @@ -454,22 +459,22 @@ */ ColorMatrixFilter.prototype.night = function(intensity, multiply) { - var intensity = intensity || 0.1; - var matrix = [ - intensity * ( -2.0), -intensity, 0, 0, 0, - -intensity, 0, intensity, 0, 0, - 0, intensity, intensity * 2.0, 0, 0, - 0,0,0,1,0, - 0,0,0,0,1 - ]; + intensity = intensity || 0.1; + var matrix = [ + intensity * ( -2.0), -intensity, 0, 0, 0, + -intensity, 0, intensity, 0, 0, + 0, intensity, intensity * 2.0, 0, 0, + 0,0,0,1,0, + 0,0,0,0,1 + ]; - this._loadMatrix(matrix, multiply); + this._loadMatrix(matrix, multiply); }; /* * Predator effect - * + * * Erase the current matrix by setting a new indepent one * * @param amount {number} how much the predator feels his future victim @@ -477,20 +482,20 @@ */ ColorMatrixFilter.prototype.predator = function(amount, multiply) { - var matrix = [ - 11.224130630493164*amount, -4.794486999511719*amount, -2.8746118545532227*amount, 0*amount, 0.40342438220977783*amount, - -3.6330697536468506*amount, 9.193157196044922*amount, -2.951810836791992*amount, 0*amount, -1.316135048866272*amount, - -3.2184197902679443*amount, -4.2375030517578125*amount, 7.476448059082031*amount, 0*amount, 0.8044459223747253*amount, - 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0 - ]; + var matrix = [ + 11.224130630493164*amount, -4.794486999511719*amount, -2.8746118545532227*amount, 0*amount, 0.40342438220977783*amount, + -3.6330697536468506*amount, 9.193157196044922*amount, -2.951810836791992*amount, 0*amount, -1.316135048866272*amount, + -3.2184197902679443*amount, -4.2375030517578125*amount, 7.476448059082031*amount, 0*amount, 0.8044459223747253*amount, + 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0 + ]; - this._loadMatrix(matrix, multiply); + this._loadMatrix(matrix, multiply); }; /* * LSD effect - * + * * Multiply the current matrix * * @param amount {number} How crazy is your effect @@ -498,26 +503,26 @@ */ ColorMatrixFilter.prototype.lsd = function(multiply) { - var matrix = [ - 2, -.4, .5, 0, 0, - -.5, 2, -.4, 0, 0, - -.4, -.5, 3, 0, 0, - 0,0,0,1,0, - 0,0,0,0,1 - ]; + var matrix = [ + 2, -0.4, 0.5, 0, 0, + -0.5, 2, -0.4, 0, 0, + -0.4, -0.5, 3, 0, 0, + 0,0,0,1,0, + 0,0,0,0,1 + ]; - this._loadMatrix(matrix, multiply); + this._loadMatrix(matrix, multiply); }; /* * Reset function * * Erase the current matrix by setting the default one - * + * */ ColorMatrixFilter.prototype.reset = function() { - var matrix = [ + var matrix = [ 1,0,0,0,0, 0,1,0,0,0, 0,0,1,0,0,