Merge pull request #138 from lvlonggame/v3

add create Animate3D interface by frame section
This commit is contained in:
XiaoYang 2014-10-11 17:36:37 +08:00
commit 72e6204426
2 changed files with 21 additions and 0 deletions

View File

@ -62,6 +62,16 @@ Animate3D* Animate3D::create(Animation3D* animation, float fromTime, float durat
return animate;
}
Animate3D* Animate3D::create(Animation3D* animation, int startFrame, int endFrame, float frameRate)
{
float perFrameTime = 1.f / frameRate;
float fromTime = startFrame * perFrameTime;
float duration = (endFrame - startFrame) * perFrameTime;
auto animate = create(animation, fromTime, duration);
return animate;
}
/** returns a clone of action */
Animate3D* Animate3D::clone() const
{

View File

@ -55,6 +55,17 @@ public:
* @return Animate3D created using animate
*/
static Animate3D* create(Animation3D* animation, float fromTime, float duration);
/**
* create Animate3D by frame section
* @param animation used to generate animate3D
* @param startFrame
* @param endFrame
* @param frameRate default is 30 per second
* @return Animate3D created using animate
*/
static Animate3D* create(Animation3D* animation, int startFrame, int endFrame, float frameRate = 30.f);
//
// Overrides
//