2019-04-11 14:40:54 +08:00
|
|
|
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
2019-03-31 01:37:06 +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.
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
#include "Action.h"
|
|
|
|
|
|
#include "Geometry.h" // ActionPath
|
|
|
|
|
|
#include "../base/logs.h"
|
|
|
|
|
|
|
2019-04-11 14:40:54 +08:00
|
|
|
|
namespace kiwano
|
2019-03-31 01:37:06 +08:00
|
|
|
|
{
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2019-04-08 14:15:27 +08:00
|
|
|
|
using EaseFunc = Closure<float(float)>;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD><C3B6>
|
|
|
|
|
|
// See https://easings.net for more information
|
|
|
|
|
|
struct Ease
|
|
|
|
|
|
{
|
2019-04-11 14:40:54 +08:00
|
|
|
|
static KGE_API EaseFunc Linear; // <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
static KGE_API EaseFunc EaseIn; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
static KGE_API EaseFunc EaseOut; // <20>ɿ<EFBFBD><C9BF><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
static KGE_API EaseFunc EaseInOut; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD>ɿ<EFBFBD><C9BF><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
static KGE_API EaseFunc ExpoIn; // <20><><EFBFBD><EFBFBD><EFBFBD>伫<EFBFBD><E4BCAB>
|
|
|
|
|
|
static KGE_API EaseFunc ExpoOut; // <20>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
static KGE_API EaseFunc ExpoInOut; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
static KGE_API EaseFunc ElasticIn; // <20><><EFBFBD><EFBFBD><EFBFBD>㸳<EFBFBD>赯<EFBFBD><E8B5AF>
|
|
|
|
|
|
static KGE_API EaseFunc ElasticOut; // <20><><EFBFBD>յ㸳<D5B5>赯<EFBFBD><E8B5AF>
|
|
|
|
|
|
static KGE_API EaseFunc ElasticInOut; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ㸳<D5B5>赯<EFBFBD><E8B5AF>
|
|
|
|
|
|
static KGE_API EaseFunc BounceIn; // <20><><EFBFBD><EFBFBD><EFBFBD>㸳<EFBFBD>跴<EFBFBD><E8B7B4><EFBFBD><EFBFBD>
|
|
|
|
|
|
static KGE_API EaseFunc BounceOut; // <20><><EFBFBD>յ㸳<D5B5>跴<EFBFBD><E8B7B4><EFBFBD><EFBFBD>
|
|
|
|
|
|
static KGE_API EaseFunc BounceInOut; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ㸳<D5B5>跴<EFBFBD><E8B7B4><EFBFBD><EFBFBD>
|
|
|
|
|
|
static KGE_API EaseFunc BackIn;
|
|
|
|
|
|
static KGE_API EaseFunc BackOut;
|
|
|
|
|
|
static KGE_API EaseFunc BackInOut;
|
|
|
|
|
|
static KGE_API EaseFunc QuadIn;
|
|
|
|
|
|
static KGE_API EaseFunc QuadOut;
|
|
|
|
|
|
static KGE_API EaseFunc QuadInOut;
|
|
|
|
|
|
static KGE_API EaseFunc CubicIn;
|
|
|
|
|
|
static KGE_API EaseFunc CubicOut;
|
|
|
|
|
|
static KGE_API EaseFunc CubicInOut;
|
|
|
|
|
|
static KGE_API EaseFunc QuartIn;
|
|
|
|
|
|
static KGE_API EaseFunc QuartOut;
|
|
|
|
|
|
static KGE_API EaseFunc QuartInOut;
|
|
|
|
|
|
static KGE_API EaseFunc QuintIn;
|
|
|
|
|
|
static KGE_API EaseFunc QuintOut;
|
|
|
|
|
|
static KGE_API EaseFunc QuintInOut;
|
|
|
|
|
|
static KGE_API EaseFunc SineIn;
|
|
|
|
|
|
static KGE_API EaseFunc SineOut;
|
|
|
|
|
|
static KGE_API EaseFunc SineInOut;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD>䶯<EFBFBD><E4B6AF>
|
2019-04-11 14:40:54 +08:00
|
|
|
|
class KGE_API ActionTween
|
2019-03-31 01:37:06 +08:00
|
|
|
|
: public Action
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
ActionTween();
|
|
|
|
|
|
|
|
|
|
|
|
ActionTween(
|
|
|
|
|
|
Duration duration,
|
|
|
|
|
|
EaseFunc func
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
// <20>Զ<EFBFBD><D4B6>建<EFBFBD><E5BBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
void SetEaseFunc(
|
|
|
|
|
|
EaseFunc const& func
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
EaseFunc const& GetEaseFunc() const;
|
|
|
|
|
|
|
|
|
|
|
|
Duration GetDuration() const;
|
|
|
|
|
|
|
|
|
|
|
|
void SetDuration(Duration duration);
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
2019-05-03 15:27:18 +08:00
|
|
|
|
void Update(NodePtr target, Duration dt) override;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-05-03 15:27:18 +08:00
|
|
|
|
virtual void UpdateTween(NodePtr target, float percent) = 0;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
Duration dur_;
|
|
|
|
|
|
EaseFunc ease_func_;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>λ<EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD>
|
2019-04-11 14:40:54 +08:00
|
|
|
|
class KGE_API ActionMoveBy
|
2019-03-31 01:37:06 +08:00
|
|
|
|
: public ActionTween
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
ActionMoveBy(
|
|
|
|
|
|
Duration duration, /* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */
|
|
|
|
|
|
Point const& vector, /* <20>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD> */
|
|
|
|
|
|
EaseFunc func = nullptr /* <20>ٶȱ仯 */
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
ActionPtr Clone() const override;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
|
|
|
|
|
|
ActionPtr Reverse() const override;
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
2019-05-03 15:27:18 +08:00
|
|
|
|
void Init(NodePtr target) override;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-05-03 15:27:18 +08:00
|
|
|
|
void UpdateTween(NodePtr target, float percent) override;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
Point start_pos_;
|
|
|
|
|
|
Point prev_pos_;
|
|
|
|
|
|
Point delta_pos_;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// λ<>ƶ<EFBFBD><C6B6><EFBFBD>
|
2019-04-11 14:40:54 +08:00
|
|
|
|
class KGE_API ActionMoveTo
|
2019-03-31 01:37:06 +08:00
|
|
|
|
: public ActionMoveBy
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
ActionMoveTo(
|
|
|
|
|
|
Duration duration, /* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */
|
|
|
|
|
|
Point const& pos, /* Ŀ<><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|
|
|
|
|
EaseFunc func = nullptr /* <20>ٶȱ仯 */
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
ActionPtr Clone() const override;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
|
|
|
|
|
|
virtual ActionPtr Reverse() const override
|
|
|
|
|
|
{
|
2019-04-11 14:40:54 +08:00
|
|
|
|
KGE_ERROR_LOG(L"Reverse() not supported in ActionMoveTo");
|
2019-03-31 01:37:06 +08:00
|
|
|
|
return nullptr;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
2019-05-03 15:27:18 +08:00
|
|
|
|
void Init(NodePtr target) override;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
Point end_pos_;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ծ<EFBFBD><D4BE><EFBFBD><EFBFBD>
|
2019-04-11 14:40:54 +08:00
|
|
|
|
class KGE_API ActionJumpBy
|
2019-03-31 01:37:06 +08:00
|
|
|
|
: public ActionTween
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
ActionJumpBy(
|
|
|
|
|
|
Duration duration, /* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */
|
|
|
|
|
|
Point const& vec, /* <20><>Ծ<EFBFBD><D4BE><EFBFBD><EFBFBD> */
|
|
|
|
|
|
float height, /* <20><>Ծ<EFBFBD>߶<EFBFBD> */
|
|
|
|
|
|
int jumps = 1, /* <20><>Ծ<EFBFBD><D4BE><EFBFBD><EFBFBD> */
|
|
|
|
|
|
EaseFunc func = nullptr /* <20>ٶȱ仯 */
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
ActionPtr Clone() const override;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
|
|
|
|
|
|
ActionPtr Reverse() const override;
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
2019-05-03 15:27:18 +08:00
|
|
|
|
void Init(NodePtr target) override;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-05-03 15:27:18 +08:00
|
|
|
|
void UpdateTween(NodePtr target, float percent) override;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
Point start_pos_;
|
|
|
|
|
|
Point delta_pos_;
|
|
|
|
|
|
float height_;
|
|
|
|
|
|
int jumps_;
|
|
|
|
|
|
Point prev_pos_;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>Ծ<EFBFBD><D4BE><EFBFBD><EFBFBD>
|
2019-04-11 14:40:54 +08:00
|
|
|
|
class KGE_API ActionJumpTo
|
2019-03-31 01:37:06 +08:00
|
|
|
|
: public ActionJumpBy
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
ActionJumpTo(
|
|
|
|
|
|
Duration duration, /* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */
|
|
|
|
|
|
Point const& pos, /* Ŀ<><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|
|
|
|
|
float height, /* <20><>Ծ<EFBFBD>߶<EFBFBD> */
|
|
|
|
|
|
int jumps = 1, /* <20><>Ծ<EFBFBD><D4BE><EFBFBD><EFBFBD> */
|
|
|
|
|
|
EaseFunc func = nullptr /* <20>ٶȱ仯 */
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
ActionPtr Clone() const override;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
|
|
|
|
|
|
virtual ActionPtr Reverse() const override
|
|
|
|
|
|
{
|
2019-04-11 14:40:54 +08:00
|
|
|
|
KGE_ERROR_LOG(L"Reverse() not supported in ActionJumpTo");
|
2019-03-31 01:37:06 +08:00
|
|
|
|
return nullptr;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
2019-05-03 15:27:18 +08:00
|
|
|
|
void Init(NodePtr target) override;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
Point end_pos_;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŷ<EFBFBD><C5B6><EFBFBD>
|
2019-04-11 14:40:54 +08:00
|
|
|
|
class KGE_API ActionScaleBy
|
2019-03-31 01:37:06 +08:00
|
|
|
|
: public ActionTween
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
ActionScaleBy(
|
|
|
|
|
|
Duration duration, /* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */
|
|
|
|
|
|
float scale, /* <20><><EFBFBD>Ա仯ֵ */
|
|
|
|
|
|
EaseFunc func = nullptr /* <20>ٶȱ仯 */
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
ActionScaleBy(
|
|
|
|
|
|
Duration duration, /* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */
|
|
|
|
|
|
float scale_x, /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա仯ֵ */
|
|
|
|
|
|
float scale_y, /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա仯ֵ */
|
|
|
|
|
|
EaseFunc func = nullptr /* <20>ٶȱ仯 */
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
ActionPtr Clone() const override;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
|
|
|
|
|
|
ActionPtr Reverse() const override;
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
2019-05-03 15:27:18 +08:00
|
|
|
|
void Init(NodePtr target) override;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-05-03 15:27:18 +08:00
|
|
|
|
void UpdateTween(NodePtr target, float percent) override;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
float start_scale_x_;
|
|
|
|
|
|
float start_scale_y_;
|
|
|
|
|
|
float delta_x_;
|
|
|
|
|
|
float delta_y_;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD>Ŷ<EFBFBD><C5B6><EFBFBD>
|
2019-04-11 14:40:54 +08:00
|
|
|
|
class KGE_API ActionScaleTo
|
2019-03-31 01:37:06 +08:00
|
|
|
|
: public ActionScaleBy
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
ActionScaleTo(
|
|
|
|
|
|
Duration duration, /* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */
|
|
|
|
|
|
float scale, /* Ŀ<><C4BF>ֵ */
|
|
|
|
|
|
EaseFunc func = nullptr /* <20>ٶȱ仯 */
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
ActionScaleTo(
|
|
|
|
|
|
Duration duration, /* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */
|
|
|
|
|
|
float scale_x, /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>ֵ */
|
|
|
|
|
|
float scale_y, /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>ֵ */
|
|
|
|
|
|
EaseFunc func = nullptr /* <20>ٶȱ仯 */
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
ActionPtr Clone() const override;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
|
|
|
|
|
|
virtual ActionPtr Reverse() const override
|
|
|
|
|
|
{
|
2019-04-11 14:40:54 +08:00
|
|
|
|
KGE_ERROR_LOG(L"Reverse() not supported in ActionScaleTo");
|
2019-03-31 01:37:06 +08:00
|
|
|
|
return nullptr;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
2019-05-03 15:27:18 +08:00
|
|
|
|
void Init(NodePtr target) override;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
float end_scale_x_;
|
|
|
|
|
|
float end_scale_y_;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// <><CDB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD><D4BD>䶯<EFBFBD><E4B6AF>
|
2019-04-11 14:40:54 +08:00
|
|
|
|
class KGE_API ActionOpacityBy
|
2019-03-31 01:37:06 +08:00
|
|
|
|
: public ActionTween
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
ActionOpacityBy(
|
|
|
|
|
|
Duration duration, /* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */
|
|
|
|
|
|
float opacity, /* <20><><EFBFBD>Ա仯ֵ */
|
|
|
|
|
|
EaseFunc func = nullptr /* <20>ٶȱ仯 */
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
ActionPtr Clone() const override;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
|
|
|
|
|
|
ActionPtr Reverse() const override;
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
2019-05-03 15:27:18 +08:00
|
|
|
|
void Init(NodePtr target) override;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-05-03 15:27:18 +08:00
|
|
|
|
void UpdateTween(NodePtr target, float percent) override;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
float start_val_;
|
|
|
|
|
|
float delta_val_;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// <><CDB8><EFBFBD>Ƚ<EFBFBD><C8BD>䶯<EFBFBD><E4B6AF>
|
2019-04-11 14:40:54 +08:00
|
|
|
|
class KGE_API ActionOpacityTo
|
2019-03-31 01:37:06 +08:00
|
|
|
|
: public ActionOpacityBy
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
ActionOpacityTo(
|
|
|
|
|
|
Duration duration, /* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */
|
|
|
|
|
|
float opacity, /* Ŀ<><C4BF>ֵ */
|
|
|
|
|
|
EaseFunc func = nullptr /* <20>ٶȱ仯 */
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
ActionPtr Clone() const override;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
|
|
|
|
|
|
virtual ActionPtr Reverse() const override
|
|
|
|
|
|
{
|
2019-04-11 14:40:54 +08:00
|
|
|
|
KGE_ERROR_LOG(L"Reverse() not supported in ActionOpacityTo");
|
2019-03-31 01:37:06 +08:00
|
|
|
|
return nullptr;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
2019-05-03 15:27:18 +08:00
|
|
|
|
void Init(NodePtr target) override;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
float end_val_;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD>붯<EFBFBD><EBB6AF>
|
2019-04-11 14:40:54 +08:00
|
|
|
|
class KGE_API ActionFadeIn
|
2019-03-31 01:37:06 +08:00
|
|
|
|
: public ActionOpacityTo
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>붯<EFBFBD><EBB6AF>
|
|
|
|
|
|
explicit ActionFadeIn(
|
|
|
|
|
|
Duration duration, /* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */
|
|
|
|
|
|
EaseFunc func = nullptr /* <20>ٶȱ仯 */
|
|
|
|
|
|
);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2019-04-11 14:40:54 +08:00
|
|
|
|
class KGE_API ActionFadeOut
|
2019-03-31 01:37:06 +08:00
|
|
|
|
: public ActionOpacityTo
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
explicit ActionFadeOut(
|
2019-04-08 14:15:27 +08:00
|
|
|
|
Duration duration, /* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */
|
|
|
|
|
|
EaseFunc func = nullptr /* <20>ٶȱ仯 */
|
2019-03-31 01:37:06 +08:00
|
|
|
|
);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>
|
2019-04-11 14:40:54 +08:00
|
|
|
|
class KGE_API ActionRotateBy
|
2019-03-31 01:37:06 +08:00
|
|
|
|
: public ActionTween
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
ActionRotateBy(
|
|
|
|
|
|
Duration duration, /* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */
|
|
|
|
|
|
float rotation, /* <20><><EFBFBD>Ա仯ֵ */
|
|
|
|
|
|
EaseFunc func = nullptr /* <20>ٶȱ仯 */
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
ActionPtr Clone() const override;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
|
|
|
|
|
|
ActionPtr Reverse() const override;
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
2019-05-03 15:27:18 +08:00
|
|
|
|
void Init(NodePtr target) override;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-05-03 15:27:18 +08:00
|
|
|
|
void UpdateTween(NodePtr target, float percent) override;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
float start_val_;
|
|
|
|
|
|
float delta_val_;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>
|
2019-04-11 14:40:54 +08:00
|
|
|
|
class KGE_API ActionRotateTo
|
2019-03-31 01:37:06 +08:00
|
|
|
|
: public ActionRotateBy
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
ActionRotateTo(
|
|
|
|
|
|
Duration duration, /* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */
|
|
|
|
|
|
float rotation, /* Ŀ<><C4BF>ֵ */
|
|
|
|
|
|
EaseFunc func = nullptr /* <20>ٶȱ仯 */
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
ActionPtr Clone() const override;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
|
|
|
|
|
|
virtual ActionPtr Reverse() const override
|
|
|
|
|
|
{
|
2019-04-11 14:40:54 +08:00
|
|
|
|
KGE_ERROR_LOG(L"Reverse() not supported in ActionRotateTo");
|
2019-03-31 01:37:06 +08:00
|
|
|
|
return nullptr;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
2019-05-03 15:27:18 +08:00
|
|
|
|
void Init(NodePtr target) override;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
float end_val_;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ·<><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2019-04-11 14:40:54 +08:00
|
|
|
|
class KGE_API ActionPath
|
2019-03-31 01:37:06 +08:00
|
|
|
|
: public ActionTween
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
ActionPath(
|
|
|
|
|
|
Duration duration, /* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */
|
2019-05-03 15:27:18 +08:00
|
|
|
|
GeometryPtr geo, /* <20><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC> */
|
2019-03-31 01:37:06 +08:00
|
|
|
|
bool rotating = false, /* <20><>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD>߷<EFBFBD><DFB7><EFBFBD><EFBFBD><EFBFBD>ת */
|
|
|
|
|
|
float start = 0.f, /* <20><><EFBFBD><EFBFBD> */
|
|
|
|
|
|
float end = 1.f, /* <20>յ<EFBFBD> */
|
|
|
|
|
|
EaseFunc func = nullptr /* <20>ٶȱ仯 */
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
ActionPtr Clone() const override;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
|
|
|
|
|
|
ActionPtr Reverse() const override;
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
2019-05-03 15:27:18 +08:00
|
|
|
|
void Init(NodePtr target) override;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-05-03 15:27:18 +08:00
|
|
|
|
void UpdateTween(NodePtr target, float percent) override;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
bool rotating_;
|
|
|
|
|
|
float start_;
|
|
|
|
|
|
float end_;
|
|
|
|
|
|
Point start_pos_;
|
|
|
|
|
|
GeometryPtr geo_;
|
|
|
|
|
|
};
|
2019-04-14 23:29:17 +08:00
|
|
|
|
|
|
|
|
|
|
|
2019-06-12 13:24:04 +08:00
|
|
|
|
// <20>Զ<EFBFBD><D4B6>嶯<EFBFBD><E5B6AF>
|
|
|
|
|
|
class KGE_API ActionCustom
|
|
|
|
|
|
: public ActionTween
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
using TweenFunc = Closure<void(NodePtr, float)>;
|
|
|
|
|
|
|
|
|
|
|
|
ActionCustom(
|
|
|
|
|
|
Duration duration, /* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */
|
|
|
|
|
|
TweenFunc tween_func, /* <20><><EFBFBD>̺<EFBFBD><CCBA><EFBFBD> */
|
|
|
|
|
|
EaseFunc func = nullptr /* <20>ٶȱ仯 */
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
ActionPtr Clone() const override;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
|
|
|
|
|
|
ActionPtr Reverse() const override
|
|
|
|
|
|
{
|
|
|
|
|
|
KGE_ERROR_LOG(L"Reverse() not supported in ActionCustom");
|
|
|
|
|
|
return nullptr;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
void Init(NodePtr target) override;
|
|
|
|
|
|
|
|
|
|
|
|
void UpdateTween(NodePtr target, float percent) override;
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
TweenFunc tween_func_;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-14 23:29:17 +08:00
|
|
|
|
// <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
|
|
|
|
|
|
class KGE_API ActionDelay
|
|
|
|
|
|
: public Action
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
ActionDelay(
|
|
|
|
|
|
Duration delay /* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
ActionPtr Clone() const override;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
|
|
|
|
|
|
ActionPtr Reverse() const override;
|
|
|
|
|
|
};
|
2019-03-31 01:37:06 +08:00
|
|
|
|
}
|