public java.lang.Float getByMethod(int method, boolean repeat) {
        elapsed = ((double) System.currentTimeMillis() - timeStart) / timeAnim;
        if (!repeat && elapsed > 1.0) 
            elapsed = 1.0;
        switch (method) {
            case -METHOD_LINE://line
                elapsed = elapsed * 2 - 1;
                break;
            case METHOD_SINE:
                elapsed = Math.sin(elapsed * (Math.PI / 2));
                break;
            case -METHOD_SINE:
                elapsed = Math.sin(elapsed * Math.PI);
                break;
            case METHOD_COS:
                elapsed = Math.sin(elapsed * (Math.PI / 2));
                break;
            case -METHOD_COS:
                elapsed = Math.sin(elapsed * Math.PI);
                break;
            case METHOD_TAN:
                elapsed = Math.tan(elapsed * (Math.PI / 4));
                break;
            case -METHOD_TAN:
                elapsed = Math.tan(elapsed * (Math.PI / 2));
                break;
        }
        return (float) (varOld * (1 - elapsed) + varNew * elapsed);
    }