Here's an Effect for Scaling:
Code:
import com.extjs.gxt.ui.client.core.El;
import com.extjs.gxt.ui.client.fx.BaseEffect;
class Scale extends BaseEffect {
private int fromWidth, toWidth;
private int fromHeight, toHeight;
Scale(El el, int width, int height) {
super(el);
el.makePositionable();
fromWidth = el.getWidth();
fromHeight = el.getHeight();
toWidth = width;
toHeight = height;
}
@Override
public void onUpdate(double progress) {
int width = (int) getValue(fromWidth, toWidth, progress);
int height = (int) getValue(fromHeight, toHeight, progress);
el.setSize(width, height);
}
@Override
public void onComplete() {
el.setSize(toWidth, toHeight);
}
}
And an Example how to use it with images:
Code:
public void onModuleLoad() {
Image image = new Image("http://code.google.com/webtoolkit/images/gwt-logo.png");
final WidgetComponent wc = new WidgetComponent(image);
image.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
new Fx(new FxConfig(2000)).run(new Scale(wc.el(), Window.getClientWidth(), Window.getClientHeight()));
}
});
RootPanel.get().add(wc);
}