fixed frame's value not right when enter frame

This commit is contained in:
2youyou2 2014-06-17 15:57:06 +08:00
parent d2a6782a9e
commit c221a59954
1 changed files with 12 additions and 34 deletions

View File

@ -33,7 +33,7 @@ NS_TIMELINE_BEGIN
// Frame // Frame
Frame::Frame() Frame::Frame()
: _frameIndex(0) : _frameIndex(0)
, _tween(false) , _tween(true)
, _timeline(nullptr) , _timeline(nullptr)
, _node(nullptr) , _node(nullptr)
{ {
@ -165,10 +165,7 @@ RotationFrame::RotationFrame()
void RotationFrame::onEnter(Frame *nextFrame) void RotationFrame::onEnter(Frame *nextFrame)
{ {
if (!_tween || nextFrame == this) _node->setRotation(_rotation);
{
_node->setRotation(_rotation);
}
if(_tween) if(_tween)
{ {
@ -218,11 +215,8 @@ SkewFrame::SkewFrame()
void SkewFrame::onEnter(Frame *nextFrame) void SkewFrame::onEnter(Frame *nextFrame)
{ {
if (!_tween || nextFrame == this) _node->setSkewX(_skewX);
{ _node->setSkewY(_skewY);
_node->setSkewX(_skewX);
_node->setSkewY(_skewY);
}
if(_tween) if(_tween)
{ {
@ -276,11 +270,8 @@ RotationSkewFrame::RotationSkewFrame()
void RotationSkewFrame::onEnter(Frame *nextFrame) void RotationSkewFrame::onEnter(Frame *nextFrame)
{ {
if (!_tween || nextFrame == this) _node->setRotationSkewX(_skewX);
{ _node->setRotationSkewY(_skewY);
_node->setRotationSkewX(_skewX);
_node->setRotationSkewY(_skewY);
}
if (_tween) if (_tween)
{ {
@ -333,11 +324,8 @@ PositionFrame::PositionFrame()
void PositionFrame::onEnter(Frame *nextFrame) void PositionFrame::onEnter(Frame *nextFrame)
{ {
if (!_tween || nextFrame == this) _node->setPosition(_position);
{
_node->setPosition(_position);
}
if(_tween) if(_tween)
{ {
_betweenX = static_cast<PositionFrame*>(nextFrame)->_position.x - _position.x; _betweenX = static_cast<PositionFrame*>(nextFrame)->_position.x - _position.x;
@ -389,11 +377,8 @@ ScaleFrame::ScaleFrame()
void ScaleFrame::onEnter(Frame *nextFrame) void ScaleFrame::onEnter(Frame *nextFrame)
{ {
if (!_tween || nextFrame == this) _node->setScaleX(_scaleX);
{ _node->setScaleY(_scaleY);
_node->setScaleX(_scaleX);
_node->setScaleY(_scaleY);
}
if(_tween) if(_tween)
{ {
@ -519,15 +504,8 @@ ColorFrame::ColorFrame()
void ColorFrame::onEnter(Frame *nextFrame) void ColorFrame::onEnter(Frame *nextFrame)
{ {
if (!_tween || nextFrame == this) _node->setOpacity(_alpha);
{ _node->setColor(_color);
if(_alpha != _node->getOpacity())
_node->setOpacity(_alpha);
Color3B color = _node->getColor();
if(color.r != _color.r || color.g != _color.r || color.b != _color.b)
_node->setColor(_color);
}
if(_tween) if(_tween)
{ {