2018-01-29 16:25:32 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2022-07-09 22:23:34 +08:00
|
|
|
https://axis-project.github.io/
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2018-01-29 16:25:32 +08:00
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2018-01-29 16:25:32 +08:00
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2018-01-29 16:25:32 +08:00
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
|
2011-05-26 21:01:16 +08:00
|
|
|
#include "EffectsTest.h"
|
|
|
|
#include "../testResource.h"
|
2014-04-27 01:11:22 +08:00
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
USING_NS_AX;
|
2015-04-09 08:37:30 +08:00
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
EffectTests::EffectTests()
|
|
|
|
{
|
2015-07-08 21:56:14 +08:00
|
|
|
ADD_TEST_CASE(Shaky3DDemo);
|
|
|
|
ADD_TEST_CASE(Waves3DDemo);
|
|
|
|
ADD_TEST_CASE(FlipX3DDemo);
|
|
|
|
ADD_TEST_CASE(FlipY3DDemo);
|
|
|
|
ADD_TEST_CASE(Lens3DDemo);
|
|
|
|
ADD_TEST_CASE(Ripple3DDemo);
|
|
|
|
ADD_TEST_CASE(LiquidDemo);
|
|
|
|
ADD_TEST_CASE(WavesDemo);
|
|
|
|
ADD_TEST_CASE(TwirlDemo);
|
|
|
|
ADD_TEST_CASE(ShakyTiles3DDemo);
|
|
|
|
ADD_TEST_CASE(ShatteredTiles3DDemo);
|
|
|
|
ADD_TEST_CASE(ShuffleTilesDemo);
|
|
|
|
ADD_TEST_CASE(FadeOutTRTilesDemo);
|
|
|
|
ADD_TEST_CASE(FadeOutBLTilesDemo);
|
|
|
|
ADD_TEST_CASE(FadeOutUpTilesDemo);
|
|
|
|
ADD_TEST_CASE(FadeOutDownTilesDemo);
|
|
|
|
ADD_TEST_CASE(TurnOffTilesDemo);
|
|
|
|
ADD_TEST_CASE(WavesTiles3DDemo);
|
|
|
|
ADD_TEST_CASE(JumpTiles3DDemo);
|
|
|
|
ADD_TEST_CASE(SplitRowsDemo);
|
|
|
|
ADD_TEST_CASE(SplitColsDemo);
|
2021-12-28 16:06:23 +08:00
|
|
|
// ADD_TEST_CASE(PageTurn3DDemo); // TODO crash on iPhone X
|
|
|
|
// ADD_TEST_CASE(PageTurn3DRectDemo);
|
2015-07-08 21:56:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
Shaky3DDemo::Shaky3DDemo()
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
_title = "Shaky3D";
|
2015-07-08 21:56:14 +08:00
|
|
|
_subtitle = "";
|
|
|
|
}
|
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::ActionInterval* Shaky3DDemo::createEffect(float t)
|
2015-07-08 21:56:14 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
return Shaky3D::create(t, Size(15, 10), 5, false);
|
2015-07-08 21:56:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
Waves3DDemo::Waves3DDemo()
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
_title = "Waves3D";
|
2015-07-08 21:56:14 +08:00
|
|
|
_subtitle = "";
|
|
|
|
}
|
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::ActionInterval* Waves3DDemo::createEffect(float t)
|
2015-07-08 21:56:14 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
return Waves3D::create(t, Size(15, 10), 5, 40);
|
2015-07-08 21:56:14 +08:00
|
|
|
}
|
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::ActionInterval* FlipX3DDemo::createEffect(float t)
|
2015-07-08 21:56:14 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
auto flipx = FlipX3D::create(t);
|
2015-07-08 21:56:14 +08:00
|
|
|
auto flipx_back = flipx->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
auto delay = DelayTime::create(2);
|
2015-07-08 21:56:14 +08:00
|
|
|
return Sequence::create(flipx, delay, flipx_back, nullptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
FlipX3DDemo::FlipX3DDemo()
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
_title = "FlipX3D";
|
2015-07-08 21:56:14 +08:00
|
|
|
_subtitle = "";
|
2015-04-03 14:31:03 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::ActionInterval* FlipY3DDemo::createEffect(float t)
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
auto flipy = FlipY3D::create(t);
|
2015-07-08 21:56:14 +08:00
|
|
|
auto flipy_back = flipy->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
auto delay = DelayTime::create(2);
|
|
|
|
|
2015-07-08 21:56:14 +08:00
|
|
|
return Sequence::create(flipy, delay, flipy_back, nullptr);
|
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
|
2015-07-08 21:56:14 +08:00
|
|
|
FlipY3DDemo::FlipY3DDemo()
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
_title = "FlipY3D";
|
2015-07-08 21:56:14 +08:00
|
|
|
_subtitle = "";
|
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::ActionInterval* Lens3DDemo::createEffect(float t)
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
2015-07-08 21:56:14 +08:00
|
|
|
auto size = Director::getInstance()->getWinSize();
|
2021-12-28 16:06:23 +08:00
|
|
|
return Lens3D::create(t, Size(15, 10), Vec2(size.width / 2, size.height / 2), 240);
|
2015-07-08 21:56:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
Lens3DDemo::Lens3DDemo()
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
_title = "Lens3D";
|
2015-07-08 21:56:14 +08:00
|
|
|
_subtitle = "";
|
|
|
|
}
|
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::ActionInterval* Ripple3DDemo::createEffect(float t)
|
2015-07-08 21:56:14 +08:00
|
|
|
{
|
|
|
|
auto size = Director::getInstance()->getWinSize();
|
2021-12-28 16:06:23 +08:00
|
|
|
return Ripple3D::create(t, Size(32, 24), Vec2(size.width / 2, size.height / 2), 240, 4, 160);
|
2015-07-08 21:56:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
Ripple3DDemo::Ripple3DDemo()
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
_title = "Ripple3D";
|
2015-07-08 21:56:14 +08:00
|
|
|
_subtitle = "";
|
|
|
|
}
|
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::ActionInterval* LiquidDemo::createEffect(float t)
|
2015-07-08 21:56:14 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
return Liquid::create(t, Size(16, 12), 4, 20);
|
2015-07-08 21:56:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
LiquidDemo::LiquidDemo()
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
_title = "Liquid";
|
2015-07-08 21:56:14 +08:00
|
|
|
_subtitle = "";
|
|
|
|
}
|
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::ActionInterval* WavesDemo::createEffect(float t)
|
2015-07-08 21:56:14 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
return Waves::create(t, Size(16, 12), 4, 20, true, true);
|
2015-07-08 21:56:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
WavesDemo::WavesDemo()
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
_title = "Waves";
|
2015-07-08 21:56:14 +08:00
|
|
|
_subtitle = "";
|
|
|
|
}
|
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::ActionInterval* TwirlDemo::createEffect(float t)
|
2015-07-08 21:56:14 +08:00
|
|
|
{
|
|
|
|
auto size = Director::getInstance()->getWinSize();
|
2021-12-28 16:06:23 +08:00
|
|
|
return Twirl::create(t, Size(12, 8), Vec2(size.width / 2, size.height / 2), 1, 2.5f);
|
2015-07-08 21:56:14 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
|
2015-07-08 21:56:14 +08:00
|
|
|
TwirlDemo::TwirlDemo()
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
_title = "Twirl";
|
2015-07-08 21:56:14 +08:00
|
|
|
_subtitle = "";
|
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::ActionInterval* ShakyTiles3DDemo::createEffect(float t)
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
return ShakyTiles3D::create(t, Size(16, 12), 5, false);
|
2015-07-08 21:56:14 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
|
2015-07-08 21:56:14 +08:00
|
|
|
ShakyTiles3DDemo::ShakyTiles3DDemo()
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
_title = "ShakyTiles3D";
|
2015-07-08 21:56:14 +08:00
|
|
|
_subtitle = "";
|
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::ActionInterval* ShatteredTiles3DDemo::createEffect(float t)
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
return ShatteredTiles3D::create(t, Size(16, 12), 5, false);
|
2015-07-08 21:56:14 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
|
2015-07-08 21:56:14 +08:00
|
|
|
ShatteredTiles3DDemo::ShatteredTiles3DDemo()
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
_title = "ShatteredTiles3D";
|
2015-07-08 21:56:14 +08:00
|
|
|
_subtitle = "";
|
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::ActionInterval* ShuffleTilesDemo::createEffect(float t)
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
auto shuffle = ShuffleTiles::create(t, Size(16, 12), 25);
|
2015-07-08 21:56:14 +08:00
|
|
|
auto shuffle_back = shuffle->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
auto delay = DelayTime::create(2);
|
|
|
|
|
2015-07-08 21:56:14 +08:00
|
|
|
return Sequence::create(shuffle, delay, shuffle_back, nullptr);
|
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
|
2015-07-08 21:56:14 +08:00
|
|
|
ShuffleTilesDemo::ShuffleTilesDemo()
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
_title = "ShuffleTiles";
|
2015-07-08 21:56:14 +08:00
|
|
|
_subtitle = "";
|
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::ActionInterval* FadeOutTRTilesDemo::createEffect(float t)
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
auto fadeout = FadeOutTRTiles::create(t, Size(16, 12));
|
|
|
|
auto back = fadeout->reverse();
|
|
|
|
auto delay = DelayTime::create(0.5f);
|
|
|
|
|
2015-07-08 21:56:14 +08:00
|
|
|
return Sequence::create(fadeout, delay, back, nullptr);
|
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
|
2015-07-08 21:56:14 +08:00
|
|
|
FadeOutTRTilesDemo::FadeOutTRTilesDemo()
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
_title = "FadeOutTRTiles";
|
2015-07-08 21:56:14 +08:00
|
|
|
_subtitle = "";
|
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::ActionInterval* FadeOutBLTilesDemo::createEffect(float t)
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
auto fadeout = FadeOutBLTiles::create(t, Size(16, 12));
|
|
|
|
auto back = fadeout->reverse();
|
|
|
|
auto delay = DelayTime::create(0.5f);
|
|
|
|
|
2015-07-08 21:56:14 +08:00
|
|
|
return Sequence::create(fadeout, delay, back, nullptr);
|
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
|
2015-07-08 21:56:14 +08:00
|
|
|
FadeOutBLTilesDemo::FadeOutBLTilesDemo()
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
_title = "FadeOutBLTiles";
|
2015-07-08 21:56:14 +08:00
|
|
|
_subtitle = "";
|
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::ActionInterval* FadeOutUpTilesDemo::createEffect(float t)
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
auto fadeout = FadeOutUpTiles::create(t, Size(16, 12));
|
|
|
|
auto back = fadeout->reverse();
|
|
|
|
auto delay = DelayTime::create(0.5f);
|
|
|
|
|
2015-07-08 21:56:14 +08:00
|
|
|
return Sequence::create(fadeout, delay, back, nullptr);
|
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
|
2015-07-08 21:56:14 +08:00
|
|
|
FadeOutUpTilesDemo::FadeOutUpTilesDemo()
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
_title = "FadeOutUpTiles";
|
2015-07-08 21:56:14 +08:00
|
|
|
_subtitle = "";
|
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::ActionInterval* FadeOutDownTilesDemo::createEffect(float t)
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
auto fadeout = FadeOutDownTiles::create(t, Size(16, 12));
|
|
|
|
auto back = fadeout->reverse();
|
|
|
|
auto delay = DelayTime::create(0.5f);
|
|
|
|
|
2015-07-08 21:56:14 +08:00
|
|
|
return Sequence::create(fadeout, delay, back, nullptr);
|
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
|
2015-07-08 21:56:14 +08:00
|
|
|
FadeOutDownTilesDemo::FadeOutDownTilesDemo()
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
_title = "FadeOutDownTiles";
|
2015-07-08 21:56:14 +08:00
|
|
|
_subtitle = "";
|
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::ActionInterval* TurnOffTilesDemo::createEffect(float t)
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
auto fadeout = TurnOffTiles::create(t, Size(48, 32), 25);
|
|
|
|
auto back = fadeout->reverse();
|
|
|
|
auto delay = DelayTime::create(0.5f);
|
|
|
|
|
2015-07-08 21:56:14 +08:00
|
|
|
return Sequence::create(fadeout, delay, back, nullptr);
|
|
|
|
}
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2015-07-08 21:56:14 +08:00
|
|
|
TurnOffTilesDemo::TurnOffTilesDemo()
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
_title = "TurnOffTiles";
|
2015-07-08 21:56:14 +08:00
|
|
|
_subtitle = "";
|
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::ActionInterval* WavesTiles3DDemo::createEffect(float t)
|
2015-07-08 21:56:14 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
return WavesTiles3D::create(t, Size(15, 10), 4, 120);
|
2015-07-08 21:56:14 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
|
2015-07-08 21:56:14 +08:00
|
|
|
WavesTiles3DDemo::WavesTiles3DDemo()
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
_title = "WavesTiles3D";
|
2015-07-08 21:56:14 +08:00
|
|
|
_subtitle = "";
|
|
|
|
}
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::ActionInterval* JumpTiles3DDemo::createEffect(float t)
|
2015-07-08 21:56:14 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
return JumpTiles3D::create(t, Size(15, 10), 2, 30);
|
2015-07-08 21:56:14 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
|
2015-07-08 21:56:14 +08:00
|
|
|
JumpTiles3DDemo::JumpTiles3DDemo()
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
_title = "JumpTiles3D";
|
2015-07-08 21:56:14 +08:00
|
|
|
_subtitle = "";
|
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::ActionInterval* SplitRowsDemo::createEffect(float t)
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
2015-07-08 21:56:14 +08:00
|
|
|
return SplitRows::create(t, 9);
|
|
|
|
}
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2015-07-08 21:56:14 +08:00
|
|
|
SplitRowsDemo::SplitRowsDemo()
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
_title = "SplitRows";
|
2015-07-08 21:56:14 +08:00
|
|
|
_subtitle = "";
|
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::ActionInterval* SplitColsDemo::createEffect(float t)
|
2015-07-08 21:56:14 +08:00
|
|
|
{
|
|
|
|
return SplitCols::create(t, 9);
|
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
|
2015-07-08 21:56:14 +08:00
|
|
|
SplitColsDemo::SplitColsDemo()
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
_title = "SplitCols";
|
2015-07-08 21:56:14 +08:00
|
|
|
_subtitle = "";
|
|
|
|
}
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::ActionInterval* PageTurn3DDemo::createEffect(float t)
|
2015-07-08 21:56:14 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
return PageTurn3D::create(t, Size(15, 10));
|
2015-07-08 21:56:14 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
|
2015-07-08 21:56:14 +08:00
|
|
|
PageTurn3DDemo::PageTurn3DDemo()
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
_title = "PageTurn3D";
|
2015-07-08 21:56:14 +08:00
|
|
|
_subtitle = "";
|
2015-07-08 22:34:33 +08:00
|
|
|
}
|
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::ActionInterval* PageTurn3DRectDemo::createEffect(float t)
|
2015-07-08 22:34:33 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
return PageTurn3D::create(t, Size(15, 10));
|
2015-07-08 22:34:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
PageTurn3DRectDemo::PageTurn3DRectDemo()
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
_title = "PageTurn3D-Rect";
|
2015-07-08 22:34:33 +08:00
|
|
|
_subtitle = "";
|
2010-08-23 10:17:29 +08:00
|
|
|
}
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
#define SID_RESTART 1
|
2011-05-26 21:01:16 +08:00
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
EffectBaseTest::EffectBaseTest() : _gridNodeTarget(nullptr) {}
|
2015-07-08 22:34:33 +08:00
|
|
|
|
|
|
|
bool EffectBaseTest::init()
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
if (TestCase::init())
|
2015-07-08 22:34:33 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
LayerColor* background = LayerColor::create(Color4B(32, 128, 32, 255));
|
|
|
|
this->addChild(background, -20);
|
|
|
|
if (isRectEffect())
|
2015-07-08 22:34:33 +08:00
|
|
|
{
|
|
|
|
Size visibleSize = Director::getInstance()->getVisibleSize();
|
2021-12-28 16:06:23 +08:00
|
|
|
Rect gridRect = Rect(visibleSize.width * 0.2, visibleSize.height * 0.2, visibleSize.width * 0.6,
|
|
|
|
visibleSize.height * 0.6);
|
|
|
|
_gridNodeTarget = NodeGrid::create(gridRect);
|
2015-07-08 22:34:33 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_gridNodeTarget = NodeGrid::create();
|
|
|
|
}
|
|
|
|
addChild(_gridNodeTarget, 0);
|
|
|
|
_gridNodeTarget->runAction(createEffect(3));
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2015-07-08 22:34:33 +08:00
|
|
|
auto bg = Sprite::create(s_back3);
|
|
|
|
_gridNodeTarget->addChild(bg, 0);
|
|
|
|
bg->setPosition(VisibleRect::center());
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2015-07-08 22:34:33 +08:00
|
|
|
auto grossini = Sprite::create(s_pathSister2);
|
|
|
|
_gridNodeTarget->addChild(grossini, 1);
|
2021-12-28 16:06:23 +08:00
|
|
|
grossini->setPosition(VisibleRect::left().x + VisibleRect::getVisibleRect().size.width / 3,
|
|
|
|
VisibleRect::center().y);
|
|
|
|
auto sc = ScaleBy::create(2, 5);
|
2015-07-08 22:34:33 +08:00
|
|
|
auto sc_back = sc->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
grossini->runAction(RepeatForever::create(Sequence::create(sc, sc_back, nullptr)));
|
|
|
|
|
2015-07-08 22:34:33 +08:00
|
|
|
auto tamara = Sprite::create(s_pathSister1);
|
|
|
|
_gridNodeTarget->addChild(tamara, 1);
|
2021-12-28 16:06:23 +08:00
|
|
|
tamara->setPosition(VisibleRect::left().x + 2 * VisibleRect::getVisibleRect().size.width / 3,
|
|
|
|
VisibleRect::center().y);
|
|
|
|
auto sc2 = ScaleBy::create(2, 5);
|
2015-07-08 22:34:33 +08:00
|
|
|
auto sc2_back = sc2->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
tamara->runAction(RepeatForever::create(Sequence::create(sc2, sc2_back, nullptr)));
|
|
|
|
|
2022-07-15 19:17:01 +08:00
|
|
|
schedule(AX_SCHEDULE_SELECTOR(EffectBaseTest::checkAnim));
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2015-07-08 22:34:33 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2011-05-26 21:01:16 +08:00
|
|
|
}
|
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
void EffectBaseTest::checkAnim(float dt)
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
if (_gridNodeTarget->getNumberOfRunningActions() == 0 && _gridNodeTarget->getGrid() != nullptr)
|
2016-09-12 09:45:34 +08:00
|
|
|
_gridNodeTarget->setGrid(nullptr);
|
2010-08-23 10:17:29 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
EffectBaseTest::~EffectBaseTest() {}
|