Jump to content

BlurFilter works, but DropShadowFilter not


Alexander Farber
 Share

Recommended Posts

Hello and good evening,

I am trying to use DropShadowFilter at a web page (please scroll down):

<script type="text/javascript" src="//cdn.jsdelivr.net/npm/pixi.js@5.2.1/dist/pixi.min.js"></script>
<script type="text/javascript" src="//cdn.jsdelivr.net/npm/pixi.js-legacy@5.2.1/dist/pixi-legacy.min.js"></script>
<script type="text/javascript" src="//cdn.jsdelivr.net/npm/pixi-filters@3.1.1/lib/pixi-filters.cjs.min.js"></script>

When I use blur filter, it just works, but drop shadow not -

                //var blurFilter = new PIXI.filters.BlurFilter();
                var shadowFilter = new PIXI.filters.DropShadowFilter();
                shadowFilter.color = 0x000020;
                shadowFilter.alpha = 0.2;
                shadowFilter.blur = 6;
                shadowFilter.distance = 20;

                function onDragStart(ev) {
                        var stagePoint = ev.data.getLocalPosition(app.stage);
                        if (card.getBounds().contains(stagePoint.x, stagePoint.y)) {
                                oldX = stagePoint.x;
                                oldY = stagePoint.y;
                                this.data = ev.data;
                                card.filters = [ shadowFilter ];
                        }
                }

                function onDragEnd() {
                        oldX = 0;
                        oldY = 0;
                        card.filters = [];
                }

The erorr message in macOS Safari is (screenshot attached):

[Error] ReferenceError: Can't find variable: exports
    Global Code (pixi-filters.cjs.min.js:7)
[Error] SyntaxError: Unexpected string literal 'DropShadowFilter'. import call expects exactly one argument.
    (anonymous function) (raspasy:122)

Does anybody please have a hint for me?

Greetings from Germany
Alex

 

 

Screenshot 2020-04-17 at 19.02.58.png

Link to comment
Share on other sites

I have got it resolved and of course it was a silly mistake by me - when I use the following it works:

<script type="text/javascript" src="//cdn.jsdelivr.net/npm/pixi-filters@3.1.1/dist/pixi-filters.js"></script>

I am not sure what was meant by the ".cjs" in the previously used URL

Thank you

Edited by Alexander Farber
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...