Pixi filters
A bug with pixi-extra-filters
by Anatoly Voevodin
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/pixi.js/4.3.4/pixi.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.19.1/TweenMax.min.js"></script>
JavaScript
/** This function is called in the bottom of code, after pixi-extra-filters code. */
function init() {
var Tile = function () {
PIXI.Container.call(this);
this.selected = false;
var shape = new PIXI.Graphics();
shape.beginFill(0xff0000);
shape.drawCircle(0, 0, 50);
shape.endFill();
this.addChild(shape);
this.interactive = true;
this.on("pointertap", function () {
if (this.selected) {
this.filters = null;
TweenLite.to(this.scale, 0.1, { x: 1, y: 1 });
} else {
this.filters = [new PIXI.filters.OutlineFilter(2, 0xFFFFFF)];
TweenLite.to(this.scale, 0.1, { x: 1.2, y: 1.2 });
}
this.selected = !this.selected;
});
}
Tile.prototype = Object.create(PIXI.Container.prototype);
Tile.prototype.constructor = Tile;
var app = new PIXI.Application(200, 200);
document.body.appendChild(app.view);
var tile1 = new Tile();
tile1.x = 100; tile1.y = 100;
app.stage.addChild(tile1);
}
/*
* 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...