Home » U++ Library support » U++ Core » Animate does not really animate
Re: Animate does not really animate [message #28657 is a reply to message #28655] |
Thu, 09 September 2010 14:38 |
frankdeprins
Messages: 99 Registered: September 2008 Location: Antwerp - Belgium
|
Member |
|
|
Yes, you are right, q is indeed only 0 as long as t < 8.
But the second issue (the flash at the end of the animation) bothers me more and I wonder what the reason is for using a separate control to do the animated popups. I managed to make it work without this extra control, but I am sure there must be some reason for this aproach.
Here is how I modified two Popup methods, resulting in less flicker:
void ColorPopUp::PopUp(Ctrl *owner, Color c)
{
int cy = norampwheel ? 0 : 110;
Size sz = AddFrameSize(18 * 16, GetCy() + cy);
Rect wr = GetWorkArea();
Rect r = owner->GetScreenRect();
int x = r.left;
int y = r.bottom;
if(x + sz.cx >= wr.right)
x = r.right - sz.cx;
if(y + sz.cy >= wr.bottom)
y = r.top - sz.cy;
Rect rt = RectC(x, y, sz.cx, sz.cy);
if(GUI_PopUpEffect()) {
SetRect(RectC(rt.left, rt.top, 1, 1));
Ctrl::PopUp(owner, true, true, GUI_GlobalStyle() >= GUISTYLE_XP);
SetFocus();
Ctrl::ProcessEvents();
Animate(*this, rt, GUIEFFECT_SLIDE);
}
else
{
SetRect(rt);
Ctrl::PopUp(owner, true, true, true);
}
SetFocus();
if(!norampwheel) {
ramp.LeftPos(0, 18*7).VSizePos(GetCy(), 0);
wheel.LeftPos(18*9 - 1, 18*7).VSizePos(GetCy(), 0);
}
ramp <<= c;
wheel <<= c;
color = c;
colori = -1;
}
void PopUpTable::PopUp(Ctrl *owner, int x, int top, int bottom, int width) {
if(inpopup)
return;
inpopup++;
DoClose();
int h = AddFrameSize(width, min(droplines * GetLineCy(), GetTotalCy())).cy;
Rect rt = RectC(x, bottom, width, h);
Rect area = Ctrl::GetWorkArea(Point(x, top));
bool up = false;
if(rt.bottom > area.bottom) {
up = true;
rt.top = top - h;
rt.bottom = rt.top + h;
}
open = false;
if (GUI_PopUpEffect()) {
if(up) {
SetRect(Rect(rt.left, rt.bottom - 1, rt.right, rt.bottom));
}
else {
SetRect(Rect(rt.left, rt.top, rt.right, rt.top + 1));
}
Ctrl::PopUp(owner, true, true, GUI_DropShadows());
SetFocus();
Ctrl::ProcessEvents();
Animate(*this, rt, GUIEFFECT_SLIDE);
CenterCursor();
open = true;
}
if (!open)
{
CenterCursor();
SetRect(rt);
Ctrl::PopUp(owner, true, true, GUI_DropShadows());
SetFocus();
open = true;
}
inpopup--;
}
PS: Thanks for applying the Animate changes. I saw you reduced the animation duration as well, and that's a good thing also; it didn't have to be that explicit.
Best regards,
frank
[Updated on: Sat, 11 September 2010 08:09] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Mon Jun 10 19:15:59 CEST 2024
Total time taken to generate the page: 0.03069 seconds
|