1. But Animation class in gwt seems to be quite handy. All you need is
bunch of custom interpolation functions. But these are easy to be
taken from MooTools (i did take se below :)) - (easing functions in
jquery behave slightly different so simple rewriting it in java drops
off).

2. Manuel - great respect for GWT-Query - actually the biggest thing i
find missing in gwt is support for "dom-programming" and lack of built-
in selector engine. But I agree with Guy that jquery-like syntax is
not necessarily an advantage :)

/** from mootools **/
    public static interface Interpolation {

        public static class Power implements Interpolation {
            protected double power;
            public Power(double power){
                this.power = power;
            }
            @Override public double interpolate(double progress) {
                return Math.pow(progress, power);
            }
        }

        public static class Back implements Interpolation {
            protected double mute = 1.618;
            public Back(double mute){
                this.mute = mute;
            }
            @Override public double interpolate(double progress) {
                return Math.pow(progress, 2) * ((mute + 1) * progress
- mute);
            }
        }

        public static class Elastic implements Interpolation {
            protected double mute = 1;
            public Elastic(double mute) {
                this.mute = mute;
            }
            @Override public double interpolate(double progress) {
                return Math.pow(2, 10 * --progress) * Math.cos(20 *
progress * Math.PI * mute / 3);
            }
        }

        public static final Interpolation ELASTIC = new Elastic(1);

        public static final Interpolation BACK = new Back(1.618);

        public static final Interpolation QUAD = new Power(2);

        public static final Interpolation CUBIC = new Power(3);

        public static final Interpolation QUART = new Power(4);

        public static final Interpolation QUINT = new Power(5);

        public static final Interpolation LINEAR = new Interpolation()
{
            @Override public double interpolate(double progress) {
                return progress;
            }
        };

        public static final Interpolation EXPO = new Interpolation() {
            @Override public double interpolate(double progress) {
                return Math.pow(2, 8 * (progress - 1));
            }
        };

        public static final Interpolation CIRC = new Interpolation() {
            @Override public double interpolate(double progress) {
                return 1 - Math.sin(Math.acos(progress));
            }
        };

        public static final Interpolation SINE = new Interpolation() {
            @Override public double interpolate(double progress) {
                return 1 - Math.cos(progress * Math.PI / 2);
            }
        };

        public static final Interpolation BOUNCE = new Interpolation()
{
            @Override public double interpolate(double progress) {
                double value;
                for (double a = 0, b = 1; true; a += b, b /= 2){
                    if (progress >= (7 - 4 * a) / 11){
                        value = b * b - Math.pow((11 - 6 * a - 11 *
progress) / 4, 2);
                        break;
                    }
                }
                return value;
            }
        };


        double interpolate(double progress);
    }

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to