2014-01-14 06:48:12 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2012 cocos2d-x.org
|
2018-01-29 16:25:32 +08:00
|
|
|
Copyright (c) 2013-2016 Chukong Technologies Inc.
|
|
|
|
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
2014-01-14 06:48:12 +08:00
|
|
|
|
2022-02-24 18:45:25 +08:00
|
|
|
https://adxeproject.github.io/
|
2014-01-14 06:48:12 +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:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
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.
|
|
|
|
****************************************************************************/
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
#include "ActionsEaseTest.h"
|
|
|
|
#include "../testResource.h"
|
|
|
|
|
2015-04-09 12:23:47 +08:00
|
|
|
USING_NS_CC;
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
enum
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
kTagAction1 = 1,
|
|
|
|
kTagAction2 = 2,
|
2021-12-28 16:06:23 +08:00
|
|
|
kTagSlider = 1,
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2014-02-17 16:30:51 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SpriteDemo
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void EaseSpriteDemo::centerSprites(unsigned int numberOfSprites)
|
|
|
|
{
|
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
if (numberOfSprites == 0)
|
2014-02-17 16:30:51 +08:00
|
|
|
{
|
|
|
|
_tamara->setVisible(false);
|
|
|
|
_kathia->setVisible(false);
|
|
|
|
_grossini->setVisible(false);
|
|
|
|
}
|
2021-12-28 16:06:23 +08:00
|
|
|
else if (numberOfSprites == 1)
|
2014-02-17 16:30:51 +08:00
|
|
|
{
|
|
|
|
_tamara->setVisible(false);
|
|
|
|
_kathia->setVisible(false);
|
2021-12-28 16:06:23 +08:00
|
|
|
_grossini->setPosition(s.width / 2, s.height / 2);
|
2014-02-17 16:30:51 +08:00
|
|
|
}
|
2021-12-28 16:06:23 +08:00
|
|
|
else if (numberOfSprites == 2)
|
2014-02-17 16:30:51 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
_kathia->setPosition(s.width / 3, s.height / 2);
|
|
|
|
_tamara->setPosition(2 * s.width / 3, s.height / 2);
|
2014-02-17 16:30:51 +08:00
|
|
|
_grossini->setVisible(false);
|
|
|
|
}
|
2021-12-28 16:06:23 +08:00
|
|
|
else if (numberOfSprites == 3)
|
2014-02-17 16:30:51 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
_grossini->setPosition(s.width / 2, s.height / 2);
|
|
|
|
_tamara->setPosition(s.width / 4, s.height / 2);
|
|
|
|
_kathia->setPosition(3 * s.width / 4, s.height / 2);
|
2014-02-17 16:30:51 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-25 17:02:58 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SpriteEase
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
2013-06-19 06:06:53 +08:00
|
|
|
|
2010-08-25 17:02:58 +08:00
|
|
|
void SpriteEase::onEnter()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
EaseSpriteDemo::onEnter();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move = MoveBy::create(3, Vec2(VisibleRect::right().x - 130, 0.0f));
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_back = move->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease_in = EaseIn::create(move->clone(), 2.5f);
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_ease_in_back = move_ease_in->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease_out = EaseOut::create(move->clone(), 2.5f);
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_ease_out_back = move_ease_out->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto delay = DelayTime::create(0.25f);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr);
|
|
|
|
auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr);
|
|
|
|
auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto a2 = _grossini->runAction(RepeatForever::create(seq1));
|
2012-04-19 14:35:52 +08:00
|
|
|
a2->setTag(1);
|
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto a1 = _tamara->runAction(RepeatForever::create(seq2));
|
2012-04-19 14:35:52 +08:00
|
|
|
a1->setTag(1);
|
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto a = _kathia->runAction(RepeatForever::create(seq3));
|
2012-04-19 14:35:52 +08:00
|
|
|
a->setTag(1);
|
|
|
|
|
2014-10-04 00:38:36 +08:00
|
|
|
schedule(CC_SCHEDULE_SELECTOR(SpriteEase::testStopAction), 6.25f);
|
2010-08-25 17:02:58 +08:00
|
|
|
}
|
|
|
|
|
2012-06-08 13:55:28 +08:00
|
|
|
void SpriteEase::testStopAction(float dt)
|
2010-08-25 17:02:58 +08:00
|
|
|
{
|
2014-10-04 00:38:36 +08:00
|
|
|
unschedule(CC_SCHEDULE_SELECTOR(SpriteEase::testStopAction));
|
2013-06-15 14:03:30 +08:00
|
|
|
_tamara->stopActionByTag(1);
|
|
|
|
_kathia->stopActionByTag(1);
|
|
|
|
_grossini->stopActionByTag(1);
|
2010-08-25 17:02:58 +08:00
|
|
|
}
|
|
|
|
|
2014-02-28 23:02:22 +08:00
|
|
|
std::string SpriteEase::subtitle() const
|
2010-08-25 17:02:58 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return "EaseIn - EaseOut - Stop";
|
|
|
|
}
|
|
|
|
|
2010-08-25 17:02:58 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SpriteEaseInOut
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2010-08-25 17:02:58 +08:00
|
|
|
void SpriteEaseInOut::onEnter()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
EaseSpriteDemo::onEnter();
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
auto move = MoveBy::create(3, Vec2(VisibleRect::right().x - 130, 0.0f));
|
|
|
|
// id move_back = move->reverse();
|
|
|
|
|
|
|
|
auto move_ease_inout1 = EaseInOut::create(move->clone(), 0.65f);
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_ease_inout_back1 = move_ease_inout1->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease_inout2 = EaseInOut::create(move->clone(), 1.35f);
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_ease_inout_back2 = move_ease_inout2->reverse();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
auto move_ease_inout3 = EaseInOut::create(move->clone(), 1.0f);
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_ease_inout_back3 = move_ease_inout3->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto delay = DelayTime::create(0.25f);
|
2012-05-04 16:22:50 +08:00
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
auto seq1 = Sequence::create(move_ease_inout1, delay, move_ease_inout_back1, delay->clone(), nullptr);
|
|
|
|
auto seq2 = Sequence::create(move_ease_inout2, delay->clone(), move_ease_inout_back2, delay->clone(), nullptr);
|
|
|
|
auto seq3 = Sequence::create(move_ease_inout3, delay->clone(), move_ease_inout_back3, delay->clone(), nullptr);
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
_tamara->runAction(RepeatForever::create(seq1));
|
|
|
|
_kathia->runAction(RepeatForever::create(seq2));
|
|
|
|
_grossini->runAction(RepeatForever::create(seq3));
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2014-02-28 23:02:22 +08:00
|
|
|
std::string SpriteEaseInOut::subtitle() const
|
2010-08-25 17:02:58 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return "EaseInOut and rates";
|
|
|
|
}
|
|
|
|
|
2010-08-25 17:02:58 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SpriteEaseExponential
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2010-08-25 17:02:58 +08:00
|
|
|
void SpriteEaseExponential::onEnter()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
EaseSpriteDemo::onEnter();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move = MoveBy::create(3, Vec2(VisibleRect::right().x - 130, 0.0f));
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_back = move->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease_in = EaseExponentialIn::create(move->clone());
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_ease_in_back = move_ease_in->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease_out = EaseExponentialOut::create(move->clone());
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_ease_out_back = move_ease_out->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto delay = DelayTime::create(0.25f);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr);
|
|
|
|
auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr);
|
|
|
|
auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
_grossini->runAction(RepeatForever::create(seq1));
|
|
|
|
_tamara->runAction(RepeatForever::create(seq2));
|
|
|
|
_kathia->runAction(RepeatForever::create(seq3));
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2014-02-28 23:02:22 +08:00
|
|
|
std::string SpriteEaseExponential::subtitle() const
|
2010-08-25 17:02:58 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return "ExpIn - ExpOut actions";
|
|
|
|
}
|
2010-08-25 17:02:58 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SpriteEaseExponentialInOut
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2010-08-25 17:02:58 +08:00
|
|
|
void SpriteEaseExponentialInOut::onEnter()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
EaseSpriteDemo::onEnter();
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
auto move = MoveBy::create(3, Vec2(VisibleRect::right().x - 130, 0.0f));
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_back = move->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease = EaseExponentialInOut::create(move->clone());
|
|
|
|
auto move_ease_back = move_ease->reverse(); //--> reverse()
|
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto delay = DelayTime::create(0.25f);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr);
|
|
|
|
auto seq2 = Sequence::create(move_ease, delay, move_ease_back, delay->clone(), nullptr);
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
this->positionForTwo();
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
_grossini->runAction(RepeatForever::create(seq1));
|
|
|
|
_tamara->runAction(RepeatForever::create(seq2));
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2014-02-28 23:02:22 +08:00
|
|
|
std::string SpriteEaseExponentialInOut::subtitle() const
|
2010-08-25 17:02:58 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return "EaseExponentialInOut action";
|
|
|
|
}
|
2010-08-25 17:02:58 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SpriteEaseSine
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2010-08-25 17:02:58 +08:00
|
|
|
void SpriteEaseSine::onEnter()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
EaseSpriteDemo::onEnter();
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
auto move = MoveBy::create(3, Vec2(VisibleRect::right().x - 130, 0.0f));
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_back = move->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease_in = EaseSineIn::create(move->clone());
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_ease_in_back = move_ease_in->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease_out = EaseSineOut::create(move->clone());
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_ease_out_back = move_ease_out->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto delay = DelayTime::create(0.25f);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr);
|
|
|
|
auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr);
|
|
|
|
auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
_grossini->runAction(RepeatForever::create(seq1));
|
|
|
|
_tamara->runAction(RepeatForever::create(seq2));
|
|
|
|
_kathia->runAction(RepeatForever::create(seq3));
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2014-02-28 23:02:22 +08:00
|
|
|
std::string SpriteEaseSine::subtitle() const
|
2010-08-25 17:02:58 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return "EaseSineIn - EaseSineOut";
|
|
|
|
}
|
2010-08-25 17:02:58 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SpriteEaseSineInOut
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2010-08-25 17:02:58 +08:00
|
|
|
void SpriteEaseSineInOut::onEnter()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
EaseSpriteDemo::onEnter();
|
2010-08-25 17:02:58 +08:00
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
auto move = MoveBy::create(3, Vec2(VisibleRect::right().x - 130, 0.0f));
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_back = move->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease = EaseSineInOut::create(move->clone());
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_ease_back = move_ease->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto delay = DelayTime::create(0.25f);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr);
|
|
|
|
auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), nullptr);
|
2010-08-25 17:02:58 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
this->positionForTwo();
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
_grossini->runAction(RepeatForever::create(seq1));
|
|
|
|
_tamara->runAction(RepeatForever::create(seq2));
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2010-08-25 17:02:58 +08:00
|
|
|
|
2014-02-28 23:02:22 +08:00
|
|
|
std::string SpriteEaseSineInOut::subtitle() const
|
2010-08-25 17:02:58 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return "EaseSineInOut action";
|
|
|
|
}
|
2010-08-25 17:02:58 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SpriteEaseElastic
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2010-08-25 17:02:58 +08:00
|
|
|
void SpriteEaseElastic::onEnter()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
EaseSpriteDemo::onEnter();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move = MoveBy::create(3, Vec2(VisibleRect::right().x - 130, 0.0f));
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_back = move->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease_in = EaseElasticIn::create(move->clone());
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_ease_in_back = move_ease_in->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease_out = EaseElasticOut::create(move->clone());
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_ease_out_back = move_ease_out->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto delay = DelayTime::create(0.25f);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr);
|
|
|
|
auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr);
|
|
|
|
auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
_grossini->runAction(RepeatForever::create(seq1));
|
|
|
|
_tamara->runAction(RepeatForever::create(seq2));
|
|
|
|
_kathia->runAction(RepeatForever::create(seq3));
|
|
|
|
}
|
2010-08-25 17:02:58 +08:00
|
|
|
|
2014-02-28 23:02:22 +08:00
|
|
|
std::string SpriteEaseElastic::subtitle() const
|
2010-08-25 17:02:58 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return "Elastic In - Out actions";
|
|
|
|
}
|
|
|
|
|
2010-08-25 17:02:58 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SpriteEaseElasticInOut
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2010-08-25 17:02:58 +08:00
|
|
|
void SpriteEaseElasticInOut::onEnter()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
EaseSpriteDemo::onEnter();
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
auto move = MoveBy::create(3, Vec2(VisibleRect::right().x - 130, 0.0f));
|
|
|
|
|
|
|
|
auto move_ease_inout1 = EaseElasticInOut::create(move->clone(), 0.3f);
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_ease_inout_back1 = move_ease_inout1->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease_inout2 = EaseElasticInOut::create(move->clone(), 0.45f);
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_ease_inout_back2 = move_ease_inout2->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease_inout3 = EaseElasticInOut::create(move->clone(), 0.6f);
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_ease_inout_back3 = move_ease_inout3->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto delay = DelayTime::create(0.25f);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
auto seq1 = Sequence::create(move_ease_inout1, delay, move_ease_inout_back1, delay->clone(), nullptr);
|
|
|
|
auto seq2 = Sequence::create(move_ease_inout2, delay->clone(), move_ease_inout_back2, delay->clone(), nullptr);
|
|
|
|
auto seq3 = Sequence::create(move_ease_inout3, delay->clone(), move_ease_inout_back3, delay->clone(), nullptr);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
_tamara->runAction(RepeatForever::create(seq1));
|
|
|
|
_kathia->runAction(RepeatForever::create(seq2));
|
|
|
|
_grossini->runAction(RepeatForever::create(seq3));
|
|
|
|
}
|
2010-08-25 17:02:58 +08:00
|
|
|
|
2014-02-28 23:02:22 +08:00
|
|
|
std::string SpriteEaseElasticInOut::subtitle() const
|
2010-08-25 17:02:58 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return "EaseElasticInOut action";
|
|
|
|
}
|
|
|
|
|
2010-08-25 17:02:58 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SpriteEaseBounce
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2010-08-25 17:02:58 +08:00
|
|
|
void SpriteEaseBounce::onEnter()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
EaseSpriteDemo::onEnter();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move = MoveBy::create(3, Vec2(VisibleRect::right().x - 130, 0.0f));
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_back = move->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease_in = EaseBounceIn::create(move->clone());
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_ease_in_back = move_ease_in->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease_out = EaseBounceOut::create(move->clone());
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_ease_out_back = move_ease_out->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto delay = DelayTime::create(0.25f);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr);
|
|
|
|
auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr);
|
|
|
|
auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
_grossini->runAction(RepeatForever::create(seq1));
|
|
|
|
_tamara->runAction(RepeatForever::create(seq2));
|
|
|
|
_kathia->runAction(RepeatForever::create(seq3));
|
|
|
|
}
|
2010-08-25 17:02:58 +08:00
|
|
|
|
2014-02-28 23:02:22 +08:00
|
|
|
std::string SpriteEaseBounce::subtitle() const
|
2010-08-25 17:02:58 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return "Bounce In - Out actions";
|
|
|
|
}
|
|
|
|
|
2010-08-25 17:02:58 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SpriteEaseBounceInOut
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2010-08-25 17:02:58 +08:00
|
|
|
void SpriteEaseBounceInOut::onEnter()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
EaseSpriteDemo::onEnter();
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
auto move = MoveBy::create(3, Vec2(VisibleRect::right().x - 130, 0.0f));
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_back = move->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease = EaseBounceInOut::create(move->clone());
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_ease_back = move_ease->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto delay = DelayTime::create(0.25f);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr);
|
|
|
|
auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), nullptr);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
this->positionForTwo();
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
_grossini->runAction(RepeatForever::create(seq1));
|
|
|
|
_tamara->runAction(RepeatForever::create(seq2));
|
|
|
|
}
|
2010-08-25 17:02:58 +08:00
|
|
|
|
2014-02-28 23:02:22 +08:00
|
|
|
std::string SpriteEaseBounceInOut::subtitle() const
|
2010-08-25 17:02:58 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return "EaseBounceInOut action";
|
|
|
|
}
|
|
|
|
|
2010-08-25 17:02:58 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SpriteEaseBack
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2010-08-25 17:02:58 +08:00
|
|
|
void SpriteEaseBack::onEnter()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
EaseSpriteDemo::onEnter();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move = MoveBy::create(3, Vec2(VisibleRect::right().x - 130, 0.0f));
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_back = move->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease_in = EaseBackIn::create(move->clone());
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_ease_in_back = move_ease_in->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease_out = EaseBackOut::create(move->clone());
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_ease_out_back = move_ease_out->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto delay = DelayTime::create(0.25f);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr);
|
|
|
|
auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr);
|
|
|
|
auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
_grossini->runAction(RepeatForever::create(seq1));
|
|
|
|
_tamara->runAction(RepeatForever::create(seq2));
|
2021-12-28 16:06:23 +08:00
|
|
|
_kathia->runAction(RepeatForever::create(seq3));
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2014-02-28 23:02:22 +08:00
|
|
|
std::string SpriteEaseBack::subtitle() const
|
2010-08-25 17:02:58 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return "Back In - Out actions";
|
|
|
|
}
|
|
|
|
|
2010-08-25 17:02:58 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SpriteEaseBackInOut
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2010-08-25 17:02:58 +08:00
|
|
|
void SpriteEaseBackInOut::onEnter()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
EaseSpriteDemo::onEnter();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move = MoveBy::create(3, Vec2(VisibleRect::right().x - 130, 0.0f));
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_back = move->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease = EaseBackInOut::create(move->clone());
|
2013-08-16 16:05:27 +08:00
|
|
|
auto move_ease_back = move_ease->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto delay = DelayTime::create(0.25f);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr);
|
|
|
|
auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), nullptr);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
this->positionForTwo();
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
_grossini->runAction(RepeatForever::create(seq1));
|
|
|
|
_tamara->runAction(RepeatForever::create(seq2));
|
|
|
|
}
|
2010-08-25 17:02:58 +08:00
|
|
|
|
2014-02-28 23:02:22 +08:00
|
|
|
std::string SpriteEaseBackInOut::subtitle() const
|
2010-08-25 17:02:58 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return "EaseBackInOut action";
|
|
|
|
}
|
|
|
|
|
2014-02-17 16:30:51 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SpriteEaseBezier
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SpriteEaseBezier::onEnter()
|
|
|
|
{
|
|
|
|
EaseSpriteDemo::onEnter();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-02-17 16:30:51 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-02-17 16:30:51 +08:00
|
|
|
//
|
|
|
|
// startPosition can be any coordinate, but since the movement
|
|
|
|
// is relative to the Bezier curve, make it (0,0)
|
|
|
|
//
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-02-17 16:30:51 +08:00
|
|
|
centerSprites(3);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-02-17 16:30:51 +08:00
|
|
|
// sprite 1
|
|
|
|
ccBezierConfig bezier;
|
2021-12-28 16:06:23 +08:00
|
|
|
bezier.controlPoint_1 = Vec2(0.0f, s.height / 2);
|
|
|
|
bezier.controlPoint_2 = Vec2(300.0f, -s.height / 2);
|
|
|
|
bezier.endPosition = Vec2(300.0f, 100.0f);
|
|
|
|
|
|
|
|
auto bezierForward = BezierBy::create(3, bezier);
|
2014-02-17 16:30:51 +08:00
|
|
|
auto bezierEaseForward = EaseBezierAction::create(bezierForward);
|
2019-09-24 11:31:35 +08:00
|
|
|
bezierEaseForward->setBezierParamer(0.5f, 0.5f, 1.0f, 1.0f);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-02-17 16:30:51 +08:00
|
|
|
auto bezierEaseBack = bezierEaseForward->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
auto rep = RepeatForever::create(Sequence::create(bezierEaseForward, bezierEaseBack, nullptr));
|
|
|
|
|
2014-02-17 16:30:51 +08:00
|
|
|
// sprite 2
|
2021-12-28 16:06:23 +08:00
|
|
|
_tamara->setPosition(80, 160);
|
|
|
|
ccBezierConfig bezier2;
|
|
|
|
bezier2.controlPoint_1 = Vec2(100.0f, s.height / 2);
|
|
|
|
bezier2.controlPoint_2 = Vec2(200.0f, -s.height / 2);
|
|
|
|
bezier2.endPosition = Vec2(240.0f, 160.0f);
|
|
|
|
|
|
|
|
auto bezierTo1 = BezierTo::create(2, bezier2);
|
2014-02-17 16:30:51 +08:00
|
|
|
auto bezierEaseTo1 = EaseBezierAction::create(bezierTo1);
|
2019-09-24 11:31:35 +08:00
|
|
|
bezierEaseTo1->setBezierParamer(0.5f, 0.5f, 1.0f, 1.0f);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-02-17 16:30:51 +08:00
|
|
|
// sprite 3
|
2021-12-28 16:06:23 +08:00
|
|
|
_kathia->setPosition(400.0f, 160.0f);
|
|
|
|
auto bezierTo2 = BezierTo::create(2, bezier2);
|
2014-02-17 16:30:51 +08:00
|
|
|
auto bezierEaseTo2 = EaseBezierAction::create(bezierTo2);
|
2019-09-24 11:31:35 +08:00
|
|
|
bezierEaseTo2->setBezierParamer(0.0f, 0.5f, -5.0f, 1.0f);
|
2014-02-17 16:30:51 +08:00
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
_grossini->runAction(rep);
|
2014-02-17 16:30:51 +08:00
|
|
|
_tamara->runAction(bezierEaseTo1);
|
2014-05-29 14:00:43 +08:00
|
|
|
_kathia->runAction(bezierEaseTo2);
|
2014-02-17 16:30:51 +08:00
|
|
|
}
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
std::string SpriteEaseBezier::subtitle() const
|
2014-02-17 16:30:51 +08:00
|
|
|
{
|
|
|
|
return "SpriteEaseBezier action";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SpriteEaseQuadratic
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SpriteEaseQuadratic::onEnter()
|
|
|
|
{
|
|
|
|
EaseSpriteDemo::onEnter();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move = MoveBy::create(3, Vec2(VisibleRect::right().x - 130, 0.0f));
|
2014-02-17 16:30:51 +08:00
|
|
|
auto move_back = move->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease_in = EaseQuadraticActionIn::create(move->clone());
|
2014-02-17 16:30:51 +08:00
|
|
|
auto move_ease_in_back = move_ease_in->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease_out = EaseQuadraticActionOut::create(move->clone());
|
2014-02-17 16:30:51 +08:00
|
|
|
auto move_ease_out_back = move_ease_out->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-02-17 16:30:51 +08:00
|
|
|
auto delay = DelayTime::create(0.25f);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr);
|
|
|
|
auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr);
|
|
|
|
auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
_grossini->runAction(RepeatForever::create(seq1));
|
|
|
|
_tamara->runAction(RepeatForever::create(seq2));
|
|
|
|
_kathia->runAction(RepeatForever::create(seq3));
|
2014-02-17 16:30:51 +08:00
|
|
|
}
|
|
|
|
|
2014-02-28 23:02:22 +08:00
|
|
|
std::string SpriteEaseQuadratic::subtitle() const
|
2014-02-17 16:30:51 +08:00
|
|
|
{
|
|
|
|
return "SpriteEaseQuadratic action";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SpriteEaseQuadraticInOut
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SpriteEaseQuadraticInOut::onEnter()
|
|
|
|
{
|
|
|
|
EaseSpriteDemo::onEnter();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move = MoveBy::create(3, Vec2(VisibleRect::right().x - 130, 0.0f));
|
2014-02-17 16:30:51 +08:00
|
|
|
auto move_back = move->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease = EaseQuadraticActionInOut::create(move->clone());
|
2014-02-17 16:30:51 +08:00
|
|
|
auto move_ease_back = move_ease->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-02-17 16:30:51 +08:00
|
|
|
auto delay = DelayTime::create(0.25f);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr);
|
|
|
|
auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), nullptr);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-02-17 16:30:51 +08:00
|
|
|
this->positionForTwo();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
_grossini->runAction(RepeatForever::create(seq1));
|
|
|
|
_tamara->runAction(RepeatForever::create(seq2));
|
2014-02-17 16:30:51 +08:00
|
|
|
}
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
std::string SpriteEaseQuadraticInOut::subtitle() const
|
2014-02-17 16:30:51 +08:00
|
|
|
{
|
|
|
|
return "SpriteEaseQuadraticInOut action";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SpriteEaseQuartic
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SpriteEaseQuartic::onEnter()
|
|
|
|
{
|
|
|
|
EaseSpriteDemo::onEnter();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move = MoveBy::create(3, Vec2(VisibleRect::right().x - 130, 0.0f));
|
2014-02-17 16:30:51 +08:00
|
|
|
auto move_back = move->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease_in = EaseQuarticActionIn::create(move->clone());
|
2014-02-17 16:30:51 +08:00
|
|
|
auto move_ease_in_back = move_ease_in->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease_out = EaseQuarticActionOut::create(move->clone());
|
2014-02-17 16:30:51 +08:00
|
|
|
auto move_ease_out_back = move_ease_out->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-02-17 16:30:51 +08:00
|
|
|
auto delay = DelayTime::create(0.25f);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr);
|
|
|
|
auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr);
|
|
|
|
auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
_grossini->runAction(RepeatForever::create(seq1));
|
|
|
|
_tamara->runAction(RepeatForever::create(seq2));
|
|
|
|
_kathia->runAction(RepeatForever::create(seq3));
|
2014-02-17 16:30:51 +08:00
|
|
|
}
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
std::string SpriteEaseQuartic::subtitle() const
|
2014-02-17 16:30:51 +08:00
|
|
|
{
|
|
|
|
return "SpriteEaseQuartic action";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SpriteEaseQuarticInOut
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SpriteEaseQuarticInOut::onEnter()
|
|
|
|
{
|
|
|
|
EaseSpriteDemo::onEnter();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move = MoveBy::create(3, Vec2(VisibleRect::right().x - 130, 0.0f));
|
2014-02-17 16:30:51 +08:00
|
|
|
auto move_back = move->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease = EaseQuarticActionInOut::create(move->clone());
|
2014-02-17 16:30:51 +08:00
|
|
|
auto move_ease_back = move_ease->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-02-17 16:30:51 +08:00
|
|
|
auto delay = DelayTime::create(0.25f);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr);
|
|
|
|
auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), nullptr);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-02-17 16:30:51 +08:00
|
|
|
this->positionForTwo();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
_grossini->runAction(RepeatForever::create(seq1));
|
|
|
|
_tamara->runAction(RepeatForever::create(seq2));
|
2014-02-17 16:30:51 +08:00
|
|
|
}
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
std::string SpriteEaseQuarticInOut::subtitle() const
|
2014-02-17 16:30:51 +08:00
|
|
|
{
|
|
|
|
return "SpriteEaseQuarticInOut action";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SpriteEaseQuintic
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SpriteEaseQuintic::onEnter()
|
|
|
|
{
|
|
|
|
EaseSpriteDemo::onEnter();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move = MoveBy::create(3, Vec2(VisibleRect::right().x - 130, 0.0f));
|
2014-02-17 16:30:51 +08:00
|
|
|
auto move_back = move->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease_in = EaseQuinticActionIn::create(move->clone());
|
2014-02-17 16:30:51 +08:00
|
|
|
auto move_ease_in_back = move_ease_in->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease_out = EaseQuinticActionOut::create(move->clone());
|
2014-02-17 16:30:51 +08:00
|
|
|
auto move_ease_out_back = move_ease_out->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-02-17 16:30:51 +08:00
|
|
|
auto delay = DelayTime::create(0.25f);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr);
|
|
|
|
auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr);
|
|
|
|
auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
_grossini->runAction(RepeatForever::create(seq1));
|
|
|
|
_tamara->runAction(RepeatForever::create(seq2));
|
|
|
|
_kathia->runAction(RepeatForever::create(seq3));
|
2014-02-17 16:30:51 +08:00
|
|
|
}
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
std::string SpriteEaseQuintic::subtitle() const
|
2014-02-17 16:30:51 +08:00
|
|
|
{
|
|
|
|
return "SpriteEaseQuintic action";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SpriteEaseQuinticInOut
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SpriteEaseQuinticInOut::onEnter()
|
|
|
|
{
|
|
|
|
EaseSpriteDemo::onEnter();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move = MoveBy::create(3, Vec2(VisibleRect::right().x - 130, 0.0f));
|
2014-02-17 16:30:51 +08:00
|
|
|
auto move_back = move->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease = EaseQuinticActionInOut::create(move->clone());
|
2014-02-17 16:30:51 +08:00
|
|
|
auto move_ease_back = move_ease->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-02-17 16:30:51 +08:00
|
|
|
auto delay = DelayTime::create(0.25f);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr);
|
|
|
|
auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), nullptr);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-02-17 16:30:51 +08:00
|
|
|
this->positionForTwo();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
_grossini->runAction(RepeatForever::create(seq1));
|
|
|
|
_tamara->runAction(RepeatForever::create(seq2));
|
2014-02-17 16:30:51 +08:00
|
|
|
}
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
std::string SpriteEaseQuinticInOut::subtitle() const
|
2014-02-17 16:30:51 +08:00
|
|
|
{
|
|
|
|
return "SpriteEaseQuinticInOut action";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SpriteEaseCircle
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SpriteEaseCircle::onEnter()
|
|
|
|
{
|
|
|
|
EaseSpriteDemo::onEnter();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move = MoveBy::create(3, Vec2(VisibleRect::right().x - 130, 0.0f));
|
2014-02-17 16:30:51 +08:00
|
|
|
auto move_back = move->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease_in = EaseCircleActionIn::create(move->clone());
|
2014-02-17 16:30:51 +08:00
|
|
|
auto move_ease_in_back = move_ease_in->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease_out = EaseCircleActionOut::create(move->clone());
|
2014-02-17 16:30:51 +08:00
|
|
|
auto move_ease_out_back = move_ease_out->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-02-17 16:30:51 +08:00
|
|
|
auto delay = DelayTime::create(0.25f);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr);
|
|
|
|
auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr);
|
|
|
|
auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
_grossini->runAction(RepeatForever::create(seq1));
|
|
|
|
_tamara->runAction(RepeatForever::create(seq2));
|
|
|
|
_kathia->runAction(RepeatForever::create(seq3));
|
2014-02-17 16:30:51 +08:00
|
|
|
}
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
std::string SpriteEaseCircle::subtitle() const
|
2014-02-17 16:30:51 +08:00
|
|
|
{
|
|
|
|
return "SpriteEaseCircle action";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SpriteEaseCircleInOut
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SpriteEaseCircleInOut::onEnter()
|
|
|
|
{
|
|
|
|
EaseSpriteDemo::onEnter();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move = MoveBy::create(3, Vec2(VisibleRect::right().x - 130, 0.0f));
|
2014-02-17 16:30:51 +08:00
|
|
|
auto move_back = move->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease = EaseCircleActionInOut::create(move->clone());
|
2014-02-17 16:30:51 +08:00
|
|
|
auto move_ease_back = move_ease->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-02-17 16:30:51 +08:00
|
|
|
auto delay = DelayTime::create(0.25f);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr);
|
|
|
|
auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), nullptr);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-02-17 16:30:51 +08:00
|
|
|
this->positionForTwo();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
_grossini->runAction(RepeatForever::create(seq1));
|
|
|
|
_tamara->runAction(RepeatForever::create(seq2));
|
2014-02-17 16:30:51 +08:00
|
|
|
}
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
std::string SpriteEaseCircleInOut::subtitle() const
|
2014-02-17 16:30:51 +08:00
|
|
|
{
|
|
|
|
return "SpriteEaseCircleInOut action";
|
|
|
|
}
|
2014-02-17 17:12:15 +08:00
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SpriteEaseCubic
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SpriteEaseCubic::onEnter()
|
|
|
|
{
|
|
|
|
EaseSpriteDemo::onEnter();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move = MoveBy::create(3, Vec2(VisibleRect::right().x - 130, 0.0f));
|
2014-02-17 17:12:15 +08:00
|
|
|
auto move_back = move->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease_in = EaseCubicActionIn::create(move->clone());
|
2014-02-17 17:12:15 +08:00
|
|
|
auto move_ease_in_back = move_ease_in->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease_out = EaseCubicActionOut::create(move->clone());
|
2014-02-17 17:12:15 +08:00
|
|
|
auto move_ease_out_back = move_ease_out->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-02-17 17:12:15 +08:00
|
|
|
auto delay = DelayTime::create(0.25f);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr);
|
|
|
|
auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr);
|
|
|
|
auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
_grossini->runAction(RepeatForever::create(seq1));
|
|
|
|
_tamara->runAction(RepeatForever::create(seq2));
|
|
|
|
_kathia->runAction(RepeatForever::create(seq3));
|
2014-02-17 17:12:15 +08:00
|
|
|
}
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
std::string SpriteEaseCubic::subtitle() const
|
2014-02-17 17:12:15 +08:00
|
|
|
{
|
|
|
|
return "SpriteEaseCubic action";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SpriteEaseCubicInOut
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SpriteEaseCubicInOut::onEnter()
|
|
|
|
{
|
|
|
|
EaseSpriteDemo::onEnter();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move = MoveBy::create(3, Vec2(VisibleRect::right().x - 130, 0.0f));
|
2014-02-17 17:12:15 +08:00
|
|
|
auto move_back = move->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
auto move_ease = EaseCubicActionInOut::create(move->clone());
|
2014-02-17 17:12:15 +08:00
|
|
|
auto move_ease_back = move_ease->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-02-17 17:12:15 +08:00
|
|
|
auto delay = DelayTime::create(0.25f);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr);
|
|
|
|
auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), nullptr);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-02-17 17:12:15 +08:00
|
|
|
this->positionForTwo();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
_grossini->runAction(RepeatForever::create(seq1));
|
|
|
|
_tamara->runAction(RepeatForever::create(seq2));
|
2014-02-17 17:12:15 +08:00
|
|
|
}
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
std::string SpriteEaseCubicInOut::title() const
|
2014-02-17 17:12:15 +08:00
|
|
|
{
|
|
|
|
return "SpriteEaseCubicInOut action";
|
|
|
|
}
|
2010-08-25 17:02:58 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SpeedTest
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2010-08-25 17:02:58 +08:00
|
|
|
void SpeedTest::onEnter()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
EaseSpriteDemo::onEnter();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
// rotate and jump
|
2021-12-28 16:06:23 +08:00
|
|
|
auto jump1 = JumpBy::create(4.0f, Vec2(-s.width + 80, 0.0f), 100.0f, 4);
|
2013-08-16 16:05:27 +08:00
|
|
|
auto jump2 = jump1->reverse();
|
2021-12-28 16:06:23 +08:00
|
|
|
auto rot1 = RotateBy::create(4.0f, 360 * 2.0f);
|
|
|
|
auto rot2 = rot1->reverse();
|
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
auto seq3_1 = Sequence::create(jump2, jump1, nullptr);
|
2021-12-28 16:06:23 +08:00
|
|
|
auto seq3_2 = Sequence::create(rot1, rot2, nullptr);
|
|
|
|
auto spawn = Spawn::create(seq3_1, seq3_2, nullptr);
|
2013-08-16 16:05:27 +08:00
|
|
|
auto action = Speed::create(RepeatForever::create(spawn), 1.0f);
|
2012-04-19 14:35:52 +08:00
|
|
|
action->setTag(kTagAction1);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto action2 = action->clone();
|
|
|
|
auto action3 = action->clone();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
action2->setTag(kTagAction1);
|
|
|
|
action3->setTag(kTagAction1);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
_grossini->runAction(action2);
|
|
|
|
_tamara->runAction(action3);
|
|
|
|
_kathia->runAction(action);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
this->schedule(CC_SCHEDULE_SELECTOR(SpeedTest::altertime), 1.0f); //:@selector(altertime:) interval:1.0f];
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2012-06-08 13:55:28 +08:00
|
|
|
void SpeedTest::altertime(float dt)
|
2021-12-28 16:06:23 +08:00
|
|
|
{
|
2013-08-16 16:05:27 +08:00
|
|
|
auto action1 = static_cast<Speed*>(_grossini->getActionByTag(kTagAction1));
|
|
|
|
auto action2 = static_cast<Speed*>(_tamara->getActionByTag(kTagAction1));
|
|
|
|
auto action3 = static_cast<Speed*>(_kathia->getActionByTag(kTagAction1));
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
action1->setSpeed(CCRANDOM_MINUS1_1() * 2);
|
|
|
|
action2->setSpeed(CCRANDOM_MINUS1_1() * 2);
|
|
|
|
action3->setSpeed(CCRANDOM_MINUS1_1() * 2);
|
2010-08-25 17:02:58 +08:00
|
|
|
}
|
|
|
|
|
2014-02-28 23:02:22 +08:00
|
|
|
std::string SpeedTest::subtitle() const
|
2010-08-25 17:02:58 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return "Speed action";
|
|
|
|
}
|
|
|
|
|
2010-08-25 17:02:58 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// EaseSpriteDemo
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
ActionsEaseTests::ActionsEaseTests()
|
2010-08-25 17:02:58 +08:00
|
|
|
{
|
2015-04-03 14:31:03 +08:00
|
|
|
ADD_TEST_CASE(SpriteEase);
|
|
|
|
ADD_TEST_CASE(SpriteEaseInOut);
|
|
|
|
ADD_TEST_CASE(SpriteEaseExponential);
|
|
|
|
ADD_TEST_CASE(SpriteEaseExponentialInOut);
|
|
|
|
ADD_TEST_CASE(SpriteEaseSine);
|
|
|
|
ADD_TEST_CASE(SpriteEaseSineInOut);
|
|
|
|
ADD_TEST_CASE(SpriteEaseElastic);
|
|
|
|
ADD_TEST_CASE(SpriteEaseElasticInOut);
|
|
|
|
ADD_TEST_CASE(SpriteEaseBounce);
|
|
|
|
ADD_TEST_CASE(SpriteEaseBounceInOut);
|
|
|
|
ADD_TEST_CASE(SpriteEaseBack);
|
|
|
|
ADD_TEST_CASE(SpriteEaseBackInOut);
|
|
|
|
ADD_TEST_CASE(SpriteEaseBezier);
|
|
|
|
ADD_TEST_CASE(SpriteEaseQuadratic);
|
|
|
|
ADD_TEST_CASE(SpriteEaseQuadraticInOut);
|
|
|
|
ADD_TEST_CASE(SpriteEaseQuartic);
|
|
|
|
ADD_TEST_CASE(SpriteEaseQuarticInOut);
|
|
|
|
ADD_TEST_CASE(SpriteEaseQuintic);
|
|
|
|
ADD_TEST_CASE(SpriteEaseQuinticInOut);
|
|
|
|
ADD_TEST_CASE(SpriteEaseCircle);
|
|
|
|
ADD_TEST_CASE(SpriteEaseCircleInOut);
|
|
|
|
ADD_TEST_CASE(SpriteEaseCubic);
|
|
|
|
ADD_TEST_CASE(SpriteEaseCubicInOut);
|
|
|
|
ADD_TEST_CASE(SpeedTest);
|
2010-08-25 17:02:58 +08:00
|
|
|
}
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
EaseSpriteDemo::EaseSpriteDemo() {}
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2019-07-22 09:38:46 +08:00
|
|
|
EaseSpriteDemo::~EaseSpriteDemo()
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-06-15 14:03:30 +08:00
|
|
|
_grossini->release();
|
|
|
|
_tamara->release();
|
|
|
|
_kathia->release();
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2010-08-25 17:02:58 +08:00
|
|
|
void EaseSpriteDemo::positionForTwo()
|
2021-12-28 16:06:23 +08:00
|
|
|
{
|
|
|
|
_grossini->setPosition(VisibleRect::left().x + 60,
|
|
|
|
VisibleRect::bottom().y + VisibleRect::getVisibleRect().size.height * 1 / 5);
|
|
|
|
_tamara->setPosition(VisibleRect::left().x + 60,
|
|
|
|
VisibleRect::bottom().y + VisibleRect::getVisibleRect().size.height * 4 / 5);
|
2013-06-15 14:03:30 +08:00
|
|
|
_kathia->setVisible(false);
|
2010-08-25 17:02:58 +08:00
|
|
|
}
|
|
|
|
|
2014-02-28 23:02:22 +08:00
|
|
|
std::string EaseSpriteDemo::subtitle() const
|
2010-08-25 17:02:58 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return "No title";
|
2010-08-25 17:02:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void EaseSpriteDemo::onEnter()
|
|
|
|
{
|
2015-04-03 14:31:03 +08:00
|
|
|
TestCase::onEnter();
|
2010-08-25 17:02:58 +08:00
|
|
|
|
2019-08-20 15:15:40 +08:00
|
|
|
// Or you can create an sprite using a filename. PNG and BMP files are supported.
|
2021-12-28 16:06:23 +08:00
|
|
|
_grossini = Sprite::create(s_pathGrossini);
|
|
|
|
_grossini->retain();
|
|
|
|
_tamara = Sprite::create(s_pathSister1);
|
|
|
|
_tamara->retain();
|
|
|
|
_kathia = Sprite::create(s_pathSister2);
|
|
|
|
_kathia->retain();
|
|
|
|
|
|
|
|
addChild(_grossini, 3);
|
|
|
|
addChild(_kathia, 2);
|
|
|
|
addChild(_tamara, 1);
|
|
|
|
|
|
|
|
_grossini->setPosition(VisibleRect::left().x + 60,
|
|
|
|
VisibleRect::bottom().y + VisibleRect::getVisibleRect().size.height * 1 / 5);
|
|
|
|
_kathia->setPosition(VisibleRect::left().x + 60,
|
|
|
|
VisibleRect::bottom().y + VisibleRect::getVisibleRect().size.height * 2.5f / 5);
|
|
|
|
_tamara->setPosition(VisibleRect::left().x + 60,
|
|
|
|
VisibleRect::bottom().y + VisibleRect::getVisibleRect().size.height * 4 / 5);
|
2010-08-25 17:02:58 +08:00
|
|
|
}
|