Jump to content

Outline filter doesn't work for me!


ErfanAsgari
 Share

Recommended Posts

Hi I've been developing a "sticker mockup generator" using pixijs and here is the result so far:

image.thumb.png.28b97e99baa0e3794f14f613bf1fad0a.png

(I used simple plane mesh to bend the png picture on the ground)

As you may know stickers come with a white (or transparent) stroke to get die cut.  something like this: 

image.thumb.png.02e65b8c349f640ce0a804938c574d8d.png

but my problem is, OutlineFilter from npm packages "pixi-filters" or "@pixi/filter-outline" doesn't work at all and throws this error:

 cannot read property of undefined: (reading thickness)

I use Pixijs 6.0.2 and WEBGL 2 (without html canvas)

 

and here is my code which works just before adding the broken line :

import * as PIXI from "pixi.js";
import { OutlineFilter } from "@pixi/filter-outline";

let app = new PIXI.Application({
    backgroundColor: 0xdddddd,
 });
document.body.appendChild(app.view);
const loader = PIXI.Loader.shared;
const container = new PIXI.Container();

loader.add("images/react.png");
loader.load((ldr, resources) => {
     const bg = new PIXI.Sprite(resources["images/react.png"].texture);
     bg.width = 300;
     bg.height = 300;
     const outlineFilter = new OutlineFilter(2, 0x002200, 2);
     bg.filters = [outlineFilter]; // broken line
     container.addChild(bg);
     app.stage.addChild(container);
 });

I also have tried this filter in multiple situations but it didn't work..:(

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...