root / web_client / src / gr / grnet / pithos / web / client / animation / FadeIn.java @ fbff60ff
History | View | Annotate | Download (949 Bytes)
1 |
/*
|
---|---|
2 |
* Copyright (c) 2011 Greek Research and Technology Network
|
3 |
*/
|
4 |
package gr.grnet.pithos.web.client.animation; |
5 |
|
6 |
import com.google.gwt.animation.client.Animation; |
7 |
import com.google.gwt.user.client.DOM; |
8 |
import com.google.gwt.user.client.ui.Widget; |
9 |
|
10 |
|
11 |
public class FadeIn extends Animation { |
12 |
Widget widget; |
13 |
int initialOpacity = 100; |
14 |
double currOpacity = 100; |
15 |
|
16 |
public FadeIn(Widget aWidget){
|
17 |
widget = aWidget; |
18 |
} |
19 |
|
20 |
@Override
|
21 |
protected void onUpdate(double progress) { |
22 |
if(currOpacity > 0.0){ |
23 |
progress = 1.0 - progress;
|
24 |
currOpacity = initialOpacity * progress; |
25 |
DOM.setStyleAttribute(widget.getElement(), "opacity", ""+new Double(1d - currOpacity / 100d)); |
26 |
//required for ie to work
|
27 |
//Disabled because IE has bugs rendering non-opaque objects
|
28 |
//int opacityToSet = new Double(currOpacity).intValue();
|
29 |
//DOM.setStyleAttribute(widget.getElement(), "filter", "alpha(opacity=" + (initialOpacity - opacityToSet) + ")");
|
30 |
} |
31 |
} |
32 |
|
33 |
} |