package org.andengine.util.modifier.ease; /** * (c) 2010 Nicolas Gramlich * (c) 2011 Zynga Inc. * * @author Gil * @author Nicolas Gramlich * @since 16:52:11 - 26.07.2010 */ public class EaseQuadInOut implements IEaseFunction { // =========================================================== // Constants // =========================================================== // =========================================================== // Fields // =========================================================== private static EaseQuadInOut INSTANCE; // =========================================================== // Constructors // =========================================================== private EaseQuadInOut() { } public static EaseQuadInOut getInstance() { if(INSTANCE == null) { INSTANCE = new EaseQuadInOut(); } return INSTANCE; } // =========================================================== // Getter & Setter // =========================================================== // =========================================================== // Methods for/from SuperClass/Interfaces // =========================================================== @Override public float getPercentage(final float pSecondsElapsed, final float pDuration) { final float percentage = pSecondsElapsed / pDuration; if(percentage < 0.5f) { return 0.5f * EaseQuadIn.getValue(2 * percentage); } else { return 0.5f + 0.5f * EaseQuadOut.getValue(percentage * 2 - 1); } } // =========================================================== // Methods // =========================================================== // =========================================================== // Inner and Anonymous Classes // =========================================================== }