2018-01-29 16:25:32 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
|
|
|
|
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
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.
|
|
|
|
****************************************************************************/
|
|
|
|
|
2016-03-20 21:53:44 +08:00
|
|
|
#include "editor-support/cocosbuilder/CCBKeyframe.h"
|
2012-09-17 14:27:17 +08:00
|
|
|
|
|
|
|
using namespace cocos2d;
|
|
|
|
|
2013-10-15 18:00:03 +08:00
|
|
|
namespace cocosbuilder {
|
2012-09-17 14:27:17 +08:00
|
|
|
|
|
|
|
CCBKeyframe::CCBKeyframe()
|
2014-10-30 22:25:46 +08:00
|
|
|
: _object(nullptr)
|
|
|
|
, _time(0.0f)
|
2013-07-27 22:31:57 +08:00
|
|
|
, _easingType(EasingType::INSTANT)
|
|
|
|
, _easingOpt(0.0f)
|
2012-09-17 14:27:17 +08:00
|
|
|
{}
|
|
|
|
|
|
|
|
CCBKeyframe::~CCBKeyframe()
|
|
|
|
{
|
2013-12-09 17:45:24 +08:00
|
|
|
CC_SAFE_RELEASE(_object);
|
2012-09-17 14:27:17 +08:00
|
|
|
}
|
|
|
|
|
2013-12-09 17:45:24 +08:00
|
|
|
const Value& CCBKeyframe::getValue() const
|
2012-09-17 14:27:17 +08:00
|
|
|
{
|
2013-07-27 22:31:57 +08:00
|
|
|
return _value;
|
2012-09-17 14:27:17 +08:00
|
|
|
}
|
|
|
|
|
2013-12-09 17:45:24 +08:00
|
|
|
void CCBKeyframe::setValue(const Value& value)
|
2012-09-17 14:27:17 +08:00
|
|
|
{
|
2013-12-09 17:45:24 +08:00
|
|
|
_value = value;
|
|
|
|
}
|
|
|
|
|
2014-02-20 10:53:49 +08:00
|
|
|
Ref* CCBKeyframe::getObject() const
|
2013-12-09 17:45:24 +08:00
|
|
|
{
|
|
|
|
return _object;
|
|
|
|
}
|
|
|
|
|
2014-02-20 10:53:49 +08:00
|
|
|
void CCBKeyframe::setObject(Ref* obj)
|
2013-12-09 17:45:24 +08:00
|
|
|
{
|
|
|
|
CC_SAFE_RETAIN(obj);
|
|
|
|
CC_SAFE_RELEASE(_object);
|
|
|
|
_object = obj;
|
2012-09-17 14:27:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
float CCBKeyframe::getTime()
|
|
|
|
{
|
2013-07-27 22:31:57 +08:00
|
|
|
return _time;
|
2012-09-17 14:27:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void CCBKeyframe::setTime(float fTime)
|
|
|
|
{
|
2013-07-27 22:31:57 +08:00
|
|
|
_time = fTime;
|
2012-09-17 14:27:17 +08:00
|
|
|
}
|
|
|
|
|
2013-07-27 21:44:49 +08:00
|
|
|
CCBKeyframe::EasingType CCBKeyframe::getEasingType()
|
2012-09-17 14:27:17 +08:00
|
|
|
{
|
2013-07-27 22:31:57 +08:00
|
|
|
return _easingType;
|
2012-09-17 14:27:17 +08:00
|
|
|
}
|
|
|
|
|
2013-07-27 21:44:49 +08:00
|
|
|
void CCBKeyframe::setEasingType(CCBKeyframe::EasingType easingType)
|
2012-09-17 14:27:17 +08:00
|
|
|
{
|
2013-07-27 22:31:57 +08:00
|
|
|
_easingType = easingType;
|
2012-09-17 14:27:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
float CCBKeyframe::getEasingOpt()
|
|
|
|
{
|
2013-07-27 22:31:57 +08:00
|
|
|
return _easingOpt;
|
2012-09-17 14:27:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void CCBKeyframe::setEasingOpt(float fEasingOpt)
|
|
|
|
{
|
2013-07-27 22:31:57 +08:00
|
|
|
_easingOpt = fEasingOpt;
|
2012-09-17 14:27:17 +08:00
|
|
|
}
|
|
|
|
|
2013-10-15 18:00:03 +08:00
|
|
|
}
|