GWT:移动小部件动画

时间:2016-10-29 22:46:27

标签: gwt

我想让动画在1000毫秒内从nX,nY到n1X,n1Y移动按钮。

我的课程: public class Start extends Animation实现了EntryPoint {

AbsolutePanel panel = new AbsolutePanel();
Label label;
Button b;
int a;

@Override
protected void onUpdate(double progress) {

    panel.setWidgetPosition(b, 2*2, 2*2);
    a++;
}

public void onModuleLoad() {
    panel = new AbsolutePanel();
    b = new Button("Click!");
    label.setText("111");

    RootPanel.get().add(label);
    RootPanel.get().add(panel);

        }

}

1 个答案:

答案 0 :(得分:0)

在GWT中制作动画非常简单:

Timer r1 = new Timer() {
                int num = 100;
                @Override
                public void run() {
                    widget.setStyleName("after");
 }
            };

Timer r = new Timer() {
                int num = 100;

                @Override
                public void run() {

                    widget.setStyleName("before");
                    num += 10;
                }
            };

r.scheduleRepeating(1000);
r1.scheduleRepeating(2000);`