blob: d7c42b9dc4703a78eb92b4b3390806671844526b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
package gwtquery.client;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NodeList;
import com.google.gwt.animation.client.Animation;
public class Effects extends GQuery {
static {
GQuery.registerPlugin(Effects.class, new EffectsPlugin());
}
public static final Class<Effects> Effects = Effects.class;
public Effects(Element element) {
super(element);
}
public Effects(JSArray elements) {
super(elements);
}
public Effects(NodeList list) {
super(list);
}
public Effects fadeOut() {
Animation a = new Animation() {
public void onCancel() {
}
public void onComplete() {
for (int i = 0; i < elements.getLength(); i++) {
elements.getItem(i).getStyle().setProperty("opacity", "0");
elements.getItem(i).getStyle().setProperty("display", "none");
}
}
public void onStart() {
}
public void onUpdate(double progress) {
for (int i = 0; i < elements.getLength(); i++) {
elements.getItem(i).getStyle()
.setProperty("opacity", String.valueOf(1.0 - progress));
}
}
};
a.run(1000);
return this;
}
public Effects fadeIn() {
Animation a = new Animation() {
public void onCancel() {
}
public void onComplete() {
}
public void onStart() {
}
public void onUpdate(double progress) {
for (int i = 0; i < elements.getLength(); i++) {
elements.getItem(i).getStyle()
.setProperty("opacity", String.valueOf(progress));
}
}
};
a.run(1000);
return this;
}
public static class EffectsPlugin implements Plugin<Effects> {
public Effects init(GQuery gq) {
return new Effects(gq.get());
}
}
}
|