0

i want to user this filter/shader in my html5 project.

The problem is on Safari and Firefox (chrome works for me) the filter/shader is only working after i reloaded the page once. Also the example page has the same problem. I tried to load the .frag file first with jQuery.get() to get the file in the cache in the firstplace but no success also.

Does anyone has an idea why this is happening?

EDIT: for better understanding:

The Shader is not rendering in Firefox and Safari if you visit the page the first time (.frag file not in cache). Only a blank(default black / background-color of the canvas) canvas is visible

4
  • Providing what code you have should help others help you faster. Commented May 22, 2016 at 15:58
  • On the example page is the code Commented May 22, 2016 at 16:07
  • Except that it's not; I don't see any use of jQuery in the example code. Commented May 22, 2016 at 16:08
  • That I used jQuery.get was only a try to fix the bug. I use the same Code as the example and like described above the bug is also happening on the example page in Safari and Firefox on initial load when you don't have the .frag file in the cache. Or after flushing your cache. Commented May 22, 2016 at 18:47

1 Answer 1

0

As I understand, you need a smooth state changing.

Each state, you can use a simple black image that fits to your game screen to fade out in a few seconds.

You should add below script at end of your create function. Like this,

    create: function(){
    //your create codes here

    blackScreen = game.add.sprite(0, 0, 'blackScreen');
            game.add.tween(blackScreen).to({
                alpha: 0
            }, 500, Phaser.Easing.Linear.None, true);

    }

This will help you to handle smooth opening/changing game screens.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your answer but that's not the Problem... the Problem is that when you as a user open the page the first time without any Assets in the cache means also the Shader File. The Shader is not loading and it only shows the empty Canvas
interested to take another look?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.