On Fri, Aug 19, 2011 at 12:42 PM, Tomasz Gawel <[email protected]> wrote: > 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).
Gwtquery (GQuery) is NOT JQuery nor needs to import it to work, they only share the API (syntax and name of methods), so GQuery has been entirely rewritten taking advance of GWT and reusing as much stuff as possible from gwt. So animate() in GQuery has nothing in common with animate in jquery() (except the name and parameters), the implementation based in the gwt class Animate, and Easing function has only one method interpolate() which is used directly by Animation. Take a look to the Easing interface in gquery which is exactly the same that your Interpolation interface, in fact we could incorporate these bunch of interpolations to the project if you authorise it. http://code.google.com/p/gwtquery/source/browse/trunk/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/PropertiesAnimation.java#37 > > 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 :) gwtquery is a gwt library, it basically introduces many nice things to the gwt world: css selectors, a lot of useful methods for dom manipulation, animations, light collections, etc, and the jquery popular syntax (method chaining). So if you only need GQuery selectors, you can use them without forcing your programmers to use jquery syntax, nor any reference to the GQuery class. Element context = anyWidget.getElement(); SelectorEngine sel = new SelectorEngine(); NodeList<Element> nodes = sel.select(".mycontainer .gwt-label", context); The same if you wanted to use Selectors optimized at compile time, etc. Summarizing take from gquery just what you need, and do not feel forced to use jquery-like syntax nor any programming pattern. Like with any other library, the gwt compiler will do its work not including in your javascript anything you do not use. > > /** 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-web-toolkit?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
