mirror of https://github.com/axmolengine/axmol.git
Merge pull request #138 from lvlonggame/v3
add create Animate3D interface by frame section
This commit is contained in:
commit
72e6204426
|
@ -62,6 +62,16 @@ Animate3D* Animate3D::create(Animation3D* animation, float fromTime, float durat
|
||||||
return animate;
|
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 */
|
/** returns a clone of action */
|
||||||
Animate3D* Animate3D::clone() const
|
Animate3D* Animate3D::clone() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,6 +55,17 @@ public:
|
||||||
* @return Animate3D created using animate
|
* @return Animate3D created using animate
|
||||||
*/
|
*/
|
||||||
static Animate3D* create(Animation3D* animation, float fromTime, float duration);
|
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
|
// Overrides
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue