REDKeyframe.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #include "REDKeyframe.h"
  2. using namespace cocos2d;
  3. namespace redream {
  4. REDKeyframe::REDKeyframe()
  5. : _object(nullptr)
  6. , _time(0.0f)
  7. , _easingType(EasingType::INSTANT)
  8. {
  9. _easingOpt = (float*)malloc(4 * sizeof(float));;
  10. }
  11. REDKeyframe::~REDKeyframe()
  12. {
  13. CC_SAFE_RELEASE(_object);
  14. CC_SAFE_FREE(_easingOpt);
  15. }
  16. const Value& REDKeyframe::getValue() const
  17. {
  18. return _value;
  19. }
  20. void REDKeyframe::setValue(const Value& value)
  21. {
  22. _value = value;
  23. }
  24. Ref* REDKeyframe::getObject() const
  25. {
  26. return _object;
  27. }
  28. void REDKeyframe::setObject(Ref* obj)
  29. {
  30. CC_SAFE_RETAIN(obj);
  31. CC_SAFE_RELEASE(_object);
  32. _object = obj;
  33. }
  34. float REDKeyframe::getTime()
  35. {
  36. return _time;
  37. }
  38. void REDKeyframe::setTime(float fTime)
  39. {
  40. _time = fTime;
  41. }
  42. REDKeyframe::EasingType REDKeyframe::getEasingType()
  43. {
  44. return _easingType;
  45. }
  46. void REDKeyframe::setEasingType(REDKeyframe::EasingType easingType)
  47. {
  48. _easingType = easingType;
  49. }
  50. float* REDKeyframe::getEasingOpt()
  51. {
  52. return _easingOpt;
  53. }
  54. void REDKeyframe::setEasingOpt(float *fEasingOpt)
  55. {
  56. _easingOpt[0] = fEasingOpt[0];
  57. _easingOpt[1] = fEasingOpt[1];
  58. _easingOpt[2] = fEasingOpt[2];
  59. _easingOpt[3] = fEasingOpt[3];
  60. }
  61. std::vector<cocos2d::Vec2> REDKeyframe::getEqualPoints() {
  62. return _equalPoints;
  63. }
  64. void REDKeyframe::setEqualPoints(std::vector<cocos2d::Vec2> equalPoints) {\
  65. _equalPoints = equalPoints;
  66. }
  67. }