Discussion:
[Wt-interest] animateHide() / animateShow() on the same widget happens instantaneously
K. Frank
2014-12-31 15:23:43 UTC
Permalink
Hello List!

I wish to use some animation when tweaking the appearance
of a widget -- say, changing the color of a button.

If I use animateHide() followed by animateShow() on the same
widget, I see no animation in the browser. That is:

myWidget->animateHide (WAnimation (WAnimation::SlideInFromLeft));
// tweak widget
myWidget->animateShow (WAnimation (WAnimation::SlideInFromLeft));

looks the same as just

// tweak widget

(The widget's appearance changes, per the tweaks, but no animation
is apparent.) It's as if the animateHide() / animateShow() pair has
been optimized away.

If instead I have two copies of the widget, myWidgetA (initially shown)
and myWidgetB (with the tweaked appearance, but initially hidden),
then

myWidgetA->animateHide (WAnimation (WAnimation::SlideInFromLeft));
myWidgetB->animateShow (WAnimation (WAnimation::SlideInFromLeft));

shows the animation and gives the visual appearance I am looking for.

Is there a way to get animateHide() / animateShow() to work with a single
widget? Is there a better approach to get a similar effect?


Thanks.


K. Frank
Koen Deforche
2015-01-05 08:07:59 UTC
Permalink
Hey,

What do you want to happen though? That both animations run sequentially
with no net effect?

Koen
Post by K. Frank
Hello List!
I wish to use some animation when tweaking the appearance
of a widget -- say, changing the color of a button.
If I use animateHide() followed by animateShow() on the same
myWidget->animateHide (WAnimation (WAnimation::SlideInFromLeft));
// tweak widget
myWidget->animateShow (WAnimation (WAnimation::SlideInFromLeft));
looks the same as just
// tweak widget
(The widget's appearance changes, per the tweaks, but no animation
is apparent.) It's as if the animateHide() / animateShow() pair has
been optimized away.
If instead I have two copies of the widget, myWidgetA (initially shown)
and myWidgetB (with the tweaked appearance, but initially hidden),
then
myWidgetA->animateHide (WAnimation (WAnimation::SlideInFromLeft));
myWidgetB->animateShow (WAnimation (WAnimation::SlideInFromLeft));
shows the animation and gives the visual appearance I am looking for.
Is there a way to get animateHide() / animateShow() to work with a single
widget? Is there a better approach to get a similar effect?
Thanks.
K. Frank
------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is
your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
witty-interest mailing list
https://lists.sourceforge.net/lists/listinfo/witty-interest
K. Frank
2015-01-07 01:07:16 UTC
Permalink
Hello Koen!

Please let me describe my use case, below. But before I do,
let me emphasize that this is just a learning experience for me,
so let me make clear that my use case is not important, and is
really just an exercise I picked pretty much at random.
Post by Koen Deforche
Hey,
What do you want to happen though? That both animations run sequentially
with no net effect?
Let's say that I have two WPushButtons, one on the left, and
one on the right. The one on the left is labelled "Hello" and
the one on the right, "Goodbye".

I wish to animateHide both buttons, change the left text to
"Goodbye" and the right text to "Hello", and then animateShow
the two buttons. Roughly speaking, I wish to swap the two
buttons with some animation eye candy. (Again, this is all
just for fun.)

When I try the above, the animations don't appear -- the text
on the two buttons changes immediately.

I will note that in this experiment the two WPushButtons are
"inline" widgets. That is (referring to my other thread on
animation) I have not called "button_->setInline (false);"

Another detail: In one version of the experiment I did call
"button_->setHiddenKeepsGeometry (true);" on both buttons
so that the location of the one button wouldn't change when
the other button was being hidden. This was an attempt to
avoid having the changing location of a button confuse its
animation.

Any pointers -- for this unimportant practice project -- would
be greatly appreciated.


Thanks.


K. Frank
Post by Koen Deforche
Koen
Post by K. Frank
Hello List!
I wish to use some animation when tweaking the appearance
of a widget -- say, changing the color of a button.
If I use animateHide() followed by animateShow() on the same
myWidget->animateHide (WAnimation (WAnimation::SlideInFromLeft));
// tweak widget
myWidget->animateShow (WAnimation (WAnimation::SlideInFromLeft));
looks the same as just
// tweak widget
(The widget's appearance changes, per the tweaks, but no animation
is apparent.) It's as if the animateHide() / animateShow() pair has
been optimized away.
If instead I have two copies of the widget, myWidgetA (initially shown)
and myWidgetB (with the tweaked appearance, but initially hidden),
then
myWidgetA->animateHide (WAnimation (WAnimation::SlideInFromLeft));
myWidgetB->animateShow (WAnimation (WAnimation::SlideInFromLeft));
shows the animation and gives the visual appearance I am looking for.
Is there a way to get animateHide() / animateShow() to work with a single
widget? Is there a better approach to get a similar effect?
Thanks.
K. Frank
...
Loading...