/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pulpcore.scene;

import pulpcore.image.filter.Glow;

/**
 *
 * @author eric
 */
public class FadeTransition extends TransitionScene {
    private boolean doGlow = false;
    private double glowAmount = 1.0;

    public FadeTransition glow(double glowAmount) {
        doGlow = true;
        this.glowAmount = glowAmount;
        return this;
    }

    public FadeTransition noGlow() {
        doGlow = false;
        return this;
    }

    protected void transitionStart() {
        if (doGlow) {
            Glow glow = new Glow(0.0,1);
            fromSprite.setFilter(glow);
            glow.amount.animateTo(glowAmount, duration, easing);
            Glow glow2 = new Glow(glowAmount,1);
            toSprite.setFilter(glow2);
            glow2.amount.animateTo(0.0, duration, easing);
        }
        toSprite.alpha.animate(0, 255, duration, easing);
        fromSprite.alpha.animate(255, 0, duration, easing);
    }
}
