最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to get pixi-filters working? - Stack Overflow

programmeradmin0浏览0评论

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)
发布评论

评论列表(0)

  1. 暂无评论