Scene that Fades in

You can make your first PG work by adding the fadeLevel property to the postProcess instance:

3 Likes

This is also great, but on my local, using Typescript has issues. It says PostProcess doesn’t have a fadeLevel. I used //@ts-ignore and it just doesn’t work. Not sure what else I could be missing, here is my TS Code (FYI the alert END isn’t triggering)


    let postProcess = new PostProcess("Fade", "fade", ["fadeLevel"], null, 1.0, currentScene.activeCamera);
    //@ts-ignore
    postProcess.fadeLevel = 1.0
    postProcess.onApply = (effect) => {
        //@ts-ignore
        effect.setFloat("fadeLevel", postProcess.fadeLevel);
    };


    const animation = new Animation('fadeAnim', "fadeLevel", 60, Animation.ANIMATIONTYPE_FLOAT)

    const fadeOutKeys = [
        { frame: 0, value: 1 },
        { frame: 100, value: 0 }
    ];
    animation.setKeys(fadeOutKeys);
    postProcess.animations.push(animation);
    scene.beginAnimation(postProcess, 0, 100,false,undefined,()=>{
        alert('end');
    })

Yes, in ts you would have to do (postProcess as any).fadeValue to access the value.

In javascript it’s ok, but in typescript it’s probably not the best way: use the solution from @11128 instead.

1 Like

ROFL !