admin管理员组

文章数量:1391937

I have imported both pixi and pixi-filters like so:

import 'pixi.js';
import 'pixi-filters';

However, after running the code:

const outlineFilterRed = new PIXI.filters.GlowFilter(15, 2, 1, 0xff9999, 0.5);

Following error is thrown:

Property 'GlowFilter' does not exist on type 'typeof filters'.

What am I doing wrong?

P.S

I'm following this example: .js

I have imported both pixi and pixi-filters like so:

import 'pixi.js';
import 'pixi-filters';

However, after running the code:

const outlineFilterRed = new PIXI.filters.GlowFilter(15, 2, 1, 0xff9999, 0.5);

Following error is thrown:

Property 'GlowFilter' does not exist on type 'typeof filters'.

What am I doing wrong?

P.S

I'm following this example: https://pixijs.github.io/examples/#/filters/outline-filter.js

Share Improve this question edited Oct 2, 2019 at 15:32 user128511 asked Sep 2, 2017 at 14:48 Alex LomiaAlex Lomia 7,23513 gold badges58 silver badges94 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 7

Seems like every filter needs to be imported individually, like it's written in the GlowFilter's README.md on Github.

Install:

npm install @pixi/filter-glow

Import:

import { GlowFilter } from '@pixi/filter-glow';

According to the definitions file, the GlowFilter (And other filters) do not exit. And according to the original js library they should exist.

This simply means that the definitions files are out-dated.

You have two options:

  • Add a local definitions to the PIXI.filters.
  • Create a PR to the definitions repository. (BEST)

本文标签: javascriptHow to get pixifilters workingStack Overflow