CCBKeyframe.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /****************************************************************************
  2. Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
  3. http://www.cocos2d-x.org
  4. Permission is hereby granted, free of charge, to any person obtaining a copy
  5. of this software and associated documentation files (the "Software"), to deal
  6. in the Software without restriction, including without limitation the rights
  7. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. copies of the Software, and to permit persons to whom the Software is
  9. furnished to do so, subject to the following conditions:
  10. The above copyright notice and this permission notice shall be included in
  11. all copies or substantial portions of the Software.
  12. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18. THE SOFTWARE.
  19. ****************************************************************************/
  20. #ifndef __CCB_KEYFRAME_H__
  21. #define __CCB_KEYFRAME_H__
  22. #include "base/CCRef.h"
  23. #include "base/CCValue.h"
  24. namespace cocosbuilder {
  25. class CC_DLL CCBKeyframe : public cocos2d::Ref
  26. {
  27. public:
  28. enum class EasingType
  29. {
  30. INSTANT,
  31. LINEAR,
  32. CUBIC_IN,
  33. CUBIC_OUT,
  34. CUBIC_INOUT,
  35. ELASTIC_IN,
  36. ELASTIC_OUT,
  37. ELASTIC_INOUT,
  38. BOUNCE_IN,
  39. BOUNCE_OUT,
  40. BOUNCE_INOUT,
  41. BACK_IN,
  42. BACK_OUT,
  43. BACK_INOUT,
  44. };
  45. /**
  46. * @js ctor
  47. */
  48. CCBKeyframe();
  49. /**
  50. * @js NA
  51. * @lua NA
  52. */
  53. ~CCBKeyframe();
  54. const cocos2d::Value& getValue() const;
  55. void setValue(const cocos2d::Value& value);
  56. cocos2d::Ref* getObject() const;
  57. void setObject(cocos2d::Ref* obj);
  58. float getTime();
  59. void setTime(float fTime);
  60. EasingType getEasingType();
  61. void setEasingType(EasingType easingType);
  62. float getEasingOpt();
  63. void setEasingOpt(float fEasingOpt);
  64. private:
  65. cocos2d::Value _value;
  66. cocos2d::Ref* _object;
  67. float _time;
  68. EasingType _easingType;
  69. float _easingOpt;
  70. };
  71. }
  72. #endif // __CCB_KEYFRAME_H__