Extrafilter and pixi 4.3.4
by Anatoly Voevodin
HTML
<script src="https://pixijs.download/release/pixi.min.js"></script>
JavaScript
/** This function is called in the bottom of code, after pixi-extra-filters code. */
function init() {
var app = new PIXI.Application(500, 500);
document.body.appendChild(app.view);
var shape = new PIXI.Graphics();
shape.beginFill(0xff0000);
shape.drawRect(0, 0, 100, 100);
shape.endFill();
shape.filters = [new PIXI.filters.OutlineFilter(2, 0xffffff)];
shape.x = 200;
shape.y = 200;
app.stage.addChild(shape);
}
/*
* It's just pixi-extra-filters (https://github.com/pixijs/pixi-extra-filters)
*/
!function(o){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=o();else if("function"==typeof define&&define.amd)define([],o);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,(e.pixiExtraFilters||(e.pixiExtraFilters={})).min=o()}}(function(){return function o(e,r,n){function t(l,a){if(!r[l]){if(!e[l]){var u="function"==typeof require&&require;if(!a&&u)return u(l,!0);if(i)return i(l,!0);var c=new Error("Cannot find module '"+l+"'");throw c.code="MODULE_NOT_FOUND",c}var s=r[l]={exports:{}};e[l][0].call(s.exports,function(o){var r=e[l][1][o];return t(r?r:o)},s,s.exports,o,e,r,n)}return r[l].exports}for(var i="function"==typeof require&&require,l=0;l<n.length;l++)t(n[l]);return t}({1:[function(o,e,r){function n(){PIXI.Filter.call(this,"#define GLSLIFY 1\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n","#define GLSLIFY 1\nuniform float radius;\nuniform float strength;\nuniform vec2 center;\nuniform sampler2D uSampler;\nuniform vec4 dimensions;\nvarying vec2 vTextureCoord;\nvoid main()\n{\n vec2 coord = vTextureCoord * dimensions.xy;\n coord -= center;\n float distance = length(coord);\n if (distance < radius) {\n float...