• Runtimes
  • How can I set start frame of animation??

  • Düzenlendi
Related Discussions
...

plattform : cocos2d-x 3.4 final
spine : recently version of your github

Hello.

I have a question.

I wanna play with animation from start 50 frame. (Animation is 100 frame)
(timeline means frame??)

Is it any wrong point my source code??

skeletonNode = SkeletonAnimation::createWithFile("test.json", "test.atlas", 1.0f);

skeletonNode->setAnimation(50, "attack_sp", true);
(trackIndex not means start frame??)

Please, let me know what can I do.

Thanks.

Tracks are effectively different layers of animations in the AnimationState:

It has the notion of “tracks” which are indexed starting at zero. The animation for each track is applied in sequence each frame, allowing animations to be applied on top of each other. Each track can have animations queued for later playback.

http://esotericsoftware.com/spine-runtime-terminology

I've never had cause to play an animation starting at a later frame. SetAnimation usually returns a TrackEntry, which has settings for current time. You might be able to set those to the value in seconds that you'd like to start playing the animation, although that won't work with blends unless you do some additional work.

Yep, grab the TrackEntry returned by SetAnimation and set the time field to the time in seconds you want the animation to start on. Spine uses 30 frames per second so if you want to start on frame 50, pass 50 / 30 = 1.666. Setting the time in this way won't hurt mixing (cross fading) animations because the time for that is stored separately, in the mixTime field on TrackEntry.

@clandestine
Thanks your advice!!

@[silindi]
Thanks your advice!!
I solved this problem with your help. : )