Tokenmagic icon indicating copy to clipboard operation
Tokenmagic copied to clipboard

Fade out effect instead of abruptly kill it

Open dmrickey opened this issue 4 years ago • 1 comments

Is there a current way to fade out an effect instead of abruptly kill it? If not can there be? (is so how?)

dmrickey avatar Mar 12 '21 16:03 dmrickey

Only if you manage to create an animation to simuate a fade effect. I'm not very familiar with all the animation parameters. Here's a toggleable, fading blur effect; it works basically like the Turn into Mystery Man effect. Maybe you can apply this to other effects. The important bits are animType: "halfCosOscillation" and loops: 1; val1 should contain the faded-out value, val2 the faded-in value. If you animate every parameter of a effect this way, you get a fading, toggleable effect.

let params =
    [{
        filterType: "blur",
        filterId: "myToggleableBlur",
        padding: 10,
        quality: 4.0,
        blur: 0,
        blurX: 0,
        blurY: 0,
        animated:
        {
            blurX:
            {
                active: true,
                animType: "halfCosOscillation",
                loopDuration: 3000,
                loops: 1,
                val1: 0,
                val2: 6
            },
            blurY:
            {
                active: true,
                animType: "halfCosOscillation",
                loopDuration: 3000,
                loops: 1,
                val1: 0,
                val2: 6
            }
        }
    }];

TokenMagic.addUpdateFiltersOnSelected(params);

But generally there's no easy way to fade-out/fade-in effects currently.

dev7355608 avatar Mar 25 '21 19:03 dev7355608