mirror of https://github.com/axmolengine/axmol.git
support set tween key
This commit is contained in:
parent
07f72ac1b4
commit
57ec881727
|
@ -293,6 +293,12 @@ void Tween::setBetween(FrameData *from, FrameData *to, bool limit)
|
||||||
}
|
}
|
||||||
while (0);
|
while (0);
|
||||||
|
|
||||||
|
if (!from->isTween)
|
||||||
|
{
|
||||||
|
_tweenData->copy(from);
|
||||||
|
_tweenData->isTween = true;
|
||||||
|
}
|
||||||
|
|
||||||
arriveKeyFrame(from);
|
arriveKeyFrame(from);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,6 +340,11 @@ FrameData *Tween::tweenNodeTo(float percent, FrameData *node)
|
||||||
{
|
{
|
||||||
node = node == NULL ? _tweenData : node;
|
node = node == NULL ? _tweenData : node;
|
||||||
|
|
||||||
|
if (!_from->isTween)
|
||||||
|
{
|
||||||
|
return _from;
|
||||||
|
}
|
||||||
|
|
||||||
node->x = _from->x + percent * _between->x;
|
node->x = _from->x + percent * _between->x;
|
||||||
node->y = _from->y + percent * _between->y;
|
node->y = _from->y + percent * _between->y;
|
||||||
node->scaleX = _from->scaleX + percent * _between->scaleX;
|
node->scaleX = _from->scaleX + percent * _between->scaleX;
|
||||||
|
|
|
@ -265,6 +265,7 @@ FrameData::FrameData(void)
|
||||||
: frameID(0)
|
: frameID(0)
|
||||||
, duration(1)
|
, duration(1)
|
||||||
, tweenEasing(Linear)
|
, tweenEasing(Linear)
|
||||||
|
, isTween(true)
|
||||||
, displayIndex(0)
|
, displayIndex(0)
|
||||||
, blendType(BLEND_NORMAL)
|
, blendType(BLEND_NORMAL)
|
||||||
|
|
||||||
|
|
|
@ -342,6 +342,7 @@ public:
|
||||||
int frameID;
|
int frameID;
|
||||||
int duration; //! The frame will last duration frames
|
int duration; //! The frame will last duration frames
|
||||||
CCTweenType tweenEasing; //! Every frame's tween easing effect
|
CCTweenType tweenEasing; //! Every frame's tween easing effect
|
||||||
|
bool isTween; //! Whether it's a tween key frame
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current display index when change to this frame.
|
* The current display index when change to this frame.
|
||||||
|
|
|
@ -101,6 +101,7 @@ static const char *A_RED_OFFSET = "rM";
|
||||||
static const char *A_GREEN_OFFSET = "gM";
|
static const char *A_GREEN_OFFSET = "gM";
|
||||||
static const char *A_BLUE_OFFSET = "bM";
|
static const char *A_BLUE_OFFSET = "bM";
|
||||||
static const char *A_COLOR_TRANSFORM = "colorTransform";
|
static const char *A_COLOR_TRANSFORM = "colorTransform";
|
||||||
|
static const char *A_TWEEN_FRAME = "tweenFrame";
|
||||||
//static const char *A_ROTATION = "rotation";
|
//static const char *A_ROTATION = "rotation";
|
||||||
//static const char *A_USE_COLOR_INFO = "uci";
|
//static const char *A_USE_COLOR_INFO = "uci";
|
||||||
|
|
||||||
|
@ -1477,6 +1478,7 @@ FrameData *DataReaderHelper::decodeFrame(cs::JsonDictionary &json)
|
||||||
frameData->tweenEasing = (CCTweenType)json.getItemIntValue(A_TWEEN_EASING, Linear);
|
frameData->tweenEasing = (CCTweenType)json.getItemIntValue(A_TWEEN_EASING, Linear);
|
||||||
frameData->displayIndex = json.getItemIntValue(A_DISPLAY_INDEX, 0);
|
frameData->displayIndex = json.getItemIntValue(A_DISPLAY_INDEX, 0);
|
||||||
frameData->blendType = (BlendType)json.getItemIntValue(A_BLEND_TYPE, 0);
|
frameData->blendType = (BlendType)json.getItemIntValue(A_BLEND_TYPE, 0);
|
||||||
|
frameData->isTween = (bool)json.getItemBoolvalue(A_TWEEN_FRAME, true);
|
||||||
|
|
||||||
const char *event = json.getItemStringValue(A_EVENT);
|
const char *event = json.getItemStringValue(A_EVENT);
|
||||||
if (event != NULL)
|
if (event != NULL)
|
||||||
|
|
Loading…
Reference in New Issue