Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Widgets|libappfw: Changed panel/popup opening animation style
  • Loading branch information
skyjake committed Sep 25, 2018
1 parent 2e56ae9 commit 99c2ffb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion doomsday/sdk/libappfw/include/de/widgets/panelwidget.h
Expand Up @@ -49,7 +49,7 @@ class LIBAPPFW_PUBLIC PanelWidget : public GuiWidget
*/
DENG2_DEFINE_AUDIENCE2(Close, void panelBeingClosed(PanelWidget &))

enum AnimationStyle { Bouncy, Smooth };
enum AnimationStyle { Bouncy, EasedOut, Smooth };

public:
PanelWidget(String const &name = String());
Expand Down
20 changes: 9 additions & 11 deletions doomsday/sdk/libappfw/src/widgets/panelwidget.cpp
Expand Up @@ -31,6 +31,7 @@
namespace de {

static TimeSpan const OPENING_ANIM_SPAN = 0.4;
static TimeSpan const OPENING_ANIM_SPAN_EASED_OUT = 0.25;
static TimeSpan const CLOSING_ANIM_SPAN = 0.3;

DENG_GUI_PIMPL(PanelWidget)
Expand All @@ -43,7 +44,7 @@ DENG_GUI_PIMPL(PanelWidget)
ui::SizePolicy secondaryPolicy = ui::Expand;
GuiWidget *content = nullptr;
AnimationRule *openingRule;
AnimationStyle openingStyle = Bouncy;
AnimationStyle openingStyle = EasedOut;
QTimer dismissTimer;
std::unique_ptr<AssetGroup> pendingShow;

Expand All @@ -64,9 +65,7 @@ DENG_GUI_PIMPL(PanelWidget)
releaseRef(openingRule);
}

void glInit()
{
}
void glInit() {}

void glDeinit()
{
Expand Down Expand Up @@ -125,12 +124,9 @@ DENG_GUI_PIMPL(PanelWidget)

switch (openingStyle)
{
case Bouncy:
openingRule->setStyle(Animation::Bounce, 12);
break;
case Smooth:
openingRule->setStyle(Animation::EaseBoth);
break;
case Bouncy: openingRule->setStyle(Animation::Bounce, 12); break;
case EasedOut: openingRule->setStyle(Animation::EaseOutSofter); break;
case Smooth: openingRule->setStyle(Animation::EaseBoth); break;
}
}

Expand All @@ -147,6 +143,7 @@ DENG_GUI_PIMPL(PanelWidget)
switch (openingStyle)
{
case Bouncy:
case EasedOut:
openingRule->setStyle(Animation::EaseIn);
break;
case Smooth:
Expand Down Expand Up @@ -354,7 +351,8 @@ void PanelWidget::open()
preparePanelForOpening();

// Start the opening animation.
d->startOpeningAnimation(OPENING_ANIM_SPAN);
d->startOpeningAnimation(d->openingStyle == EasedOut ? OPENING_ANIM_SPAN_EASED_OUT
: OPENING_ANIM_SPAN);

d->opened = true;

Expand Down

0 comments on commit 99c2ffb

Please sign in to comment.