REDKeyframe.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #ifndef __RED_KEYFRAME_H__
  2. #define __RED_KEYFRAME_H__
  3. #include "base/CCRef.h"
  4. #include "base/CCValue.h"
  5. #include "math/Vec2.h"
  6. namespace redream {
  7. class CC_DLL REDKeyframe : public cocos2d::Ref
  8. {
  9. public:
  10. enum class EasingType
  11. {
  12. INSTANT,
  13. LINEAR,
  14. CUBIC_IN,
  15. CUBIC_OUT,
  16. CUBIC_INOUT,
  17. ELASTIC_IN,
  18. ELASTIC_OUT,
  19. ELASTIC_INOUT,
  20. BOUNCE_IN,
  21. BOUNCE_OUT,
  22. BOUNCE_INOUT,
  23. BACK_IN,
  24. BACK_OUT,
  25. BACK_INOUT,
  26. //新加的类型正弦变化【0,PI/2】
  27. SineIn,
  28. SineOut,
  29. SineInOut,
  30. ExponentialIn,
  31. ExponentialOut,
  32. ExponentialInOut,
  33. CircleActionIn,
  34. CircleActionOut,
  35. CircleActionInOut,
  36. //2次
  37. QuadraticActionIn,
  38. QuadraticActionOut,
  39. QuadraticActionInOut,
  40. //3次
  41. CubicActionIn,
  42. CubicActionOut,
  43. CubicActionInOut,
  44. //4次
  45. QuarticActionIn,
  46. QuarticActionOut,
  47. QuarticActionInOut,
  48. //5次
  49. QuinticActionIn,
  50. QuinticActionOut,
  51. QuinticActionInOut,
  52. Custom,//自定义曲线
  53. };
  54. /**
  55. * @js ctor
  56. */
  57. REDKeyframe();
  58. /**
  59. * @js NA
  60. * @lua NA
  61. */
  62. ~REDKeyframe();
  63. const cocos2d::Value& getValue() const;
  64. void setValue(const cocos2d::Value& value);
  65. cocos2d::Ref* getObject() const;
  66. void setObject(cocos2d::Ref* obj);
  67. float getTime();
  68. void setTime(float fTime);
  69. EasingType getEasingType();
  70. void setEasingType(EasingType easingType);
  71. float* getEasingOpt();
  72. void setEasingOpt(float *fEasingOpt);
  73. std::vector<cocos2d::Vec2> getEqualPoints();
  74. void setEqualPoints(std::vector<cocos2d::Vec2> equalPoints);
  75. private:
  76. cocos2d::Value _value;
  77. cocos2d::Ref* _object;
  78. float _time;
  79. EasingType _easingType;
  80. float *_easingOpt;
  81. std::vector<cocos2d::Vec2> _equalPoints = {};
  82. };
  83. }
  84. #endif // __RED_KEYFRAME_H__