AnimationUtil.java :  » Game » magicwars » mw » client » gui » plaf » Java Open Source

Java Open Source » Game » magicwars 
magicwars » mw » client » gui » plaf » AnimationUtil.java
/*
 * AnimationUtil.java
 *
 * Created on April 3, 2006, 10:11 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package mw.client.gui.plaf;

import org.jdesktop.animation.timing.Animator;
import org.jdesktop.animation.timing.interpolation.PropertySetter;
import org.jdesktop.swingx.JXPanel;

/**
 * Utility class for animation 
 */
public final class AnimationUtil {

    /** Creates a new instance of AnimationUtil */
    private AnimationUtil() {
    }

    public static Animator createFadeInAnimation(JXPanel panel) {
        return createFadeAnimation(panel, 0.01f, .99f);
    }

    public static Animator createFadeOutAnimation(JXPanel panel) {
        return createFadeAnimation(panel, 0.99f, .01f);
    }

    public static Animator createFadeAnimation(JXPanel panel, float start, float end) {
        Animator animator = PropertySetter.createAnimator(400,panel,"alpha",start,end);
        animator.setAcceleration(0.7f);
        animator.setDeceleration(0.3f);
        return animator;
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.