axmol/tests/fairygui-tests/Source/Window2.cpp

32 lines
725 B
C++
Raw Normal View History

2020-08-04 13:15:02 +08:00
#include "Window2.h"
USING_NS_AX;
2020-08-04 13:15:02 +08:00
void Window2::onInit()
{
setContentPane(UIPackage::createObject("Basics", "WindowB")->as<GComponent>());
center();
}
void Window2::doShowAnimation()
{
setScale(0.1f, 0.1f);
setPivot(0.5f, 0.5f);
2022-07-16 10:43:05 +08:00
GTween::to(getScale(), Vec2::ONE, 0.3f)->setTarget(this, TweenPropType::Scale)->onComplete(AX_CALLBACK_0(Window2::onShown, this));
2020-08-04 13:15:02 +08:00
}
void Window2::doHideAnimation()
{
2022-07-16 10:43:05 +08:00
GTween::to(getScale(), Vec2(0.1f, 0.1f), 0.3f)->setTarget(this, TweenPropType::Scale)->onComplete(AX_CALLBACK_0(Window2::hideImmediately, this));
2020-08-04 13:15:02 +08:00
}
void Window2::onShown()
{
_contentPane->getTransition("t1")->play();
}
void Window2::onHide()
{
_contentPane->getTransition("t1")->stop();
}