Skip to content

Using AdjustmentFilter in @pixi/webworker causes an error #486

@gubeils

Description

@gubeils

I am using the following versions in my project:

"@pixi/webworker": "^7.4.2"
"pixi-filters": "^5.3.0"
When I try to use AdjustmentFilter within a Web Worker, it results in an error.

Here is the code snippet:

import * as PIXI from "@pixi/webworker";

const adjustmentFilter = new AdjustmentFilter({
  brightness: 1.2, 
  contrast: 1.5,   
  saturation: 1.3, 
  gamma: 1.0,      
  red: 1.1,       
  green: 1.0,      
  blue: 0.9,       
});
videoSprite.filters = [adjustmentFilter];

app.stage.addChild(videoSprite);

Error Message:
adapter.ts:36 Uncaught (in promise) ReferenceError: document is not defined

Image

It seems like the AdjustmentFilter is trying to access the document object, which is unavailable in the Web Worker context.

How can I make AdjustmentFilter work in the Web Worker environment? Are there any workarounds or specific configurations needed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions