Hi Dan
Yes, animations seem to be based on DOM elements. But you can get the
DOM Element of almost every rendered Widget and use that for animation.
The challenge here is to apply the animation at the right time.
I did a test with animating windows in and out, and i'm fairly pleased
with the results. Here is what i came up with:
Every Widget has the "appear" event. It is fired whenever the widget
appears on screen. You can listen to that to trigger your fade-in
animation. Like this (add the following code to your windows constructor
or layout setup function):
-- snip --
this.addListener("appear", function(evt){
var domElem = this.getContainerElement().getDomElement();
var fade = new qx.fx.effect.core.Fade(domElem).set({
from: 0,
to: 1
});
fade.start();
}, this);
-- snap --
The closing sadly doesn't work with the disappear event, since that one
is fired when the widget is already removed (there's no more DOM element
to animate). For a window however, you can simply override the "close"
method and fire the base close method delayed. Like so:
-- snip --
close : function(){
var domElem = this.getContainerElement().getDomElement();
var fade = new qx.fx.effect.core.Fade(domElem).set({
from: 1,
to: 0
});
var args = arguments;
fade.addListener("finish", function(evt){
this.base(args);
}, this);
fade.start();
},
-- snap --
You'll have to store the "arguments" in a "intermediate" variable to
prevent it from being shadowed by another arguments value. Other than
that, it should be quite quite clear what's going on.
This approach works very well, except for a small nuisance, which is:
whenever you open a window the first time, it may flash to 100% visible,
then start to fade in. Further closing and re-opening works fine,
because the opacity is a 0% after the first close...
Maybe you find a good solution to this problem?
Cheers - Roman
Dan wrote:
> I'd like to create a Window subclass that works exactly like a Window
> but that appears with a fade in and closes with a fade out. I'm
> confused about how to achieve this. Animation are rather low-level,
> I'm not sure when exactly the DOM elements are created and it has to
> play nice with the queue that controls when widgets are actually
> rendered.
>
> Where should I start?
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel