Seems like there is nothing happening for me when setting the spine playback rate with go.set.
Doing like this:
-- will play in original (1) playback_rate
go.set("#spinemodel", "playback_rate", 5)
spine.play_anim("#spinemodel", "some_anim", go.PLAYBACK_ONCE_FORWARD)
Will still play a spinemodel in original rate. (also if passing in an empty table as parameter).
Still the following works as expected.
-- works as expected
spine.play_anim("#spinemodel", "some_anim", go.PLAYBACK_ONCE_FORWARD, { playback_rate = 5 })
Well when animating cursor on my own I decide the speed so it must be playrate on the spine.play_anim function, right?
And http://www.defold.com/ref/spine/#playback_rate really looks like that.
I am now trying the cursor functionality and cannot get it to work when changing animation.
Say I want to set the cursor to the end of an animation of choice.
I guess I would do like this:
It doesn’t work either as the animation is played from start. Could someone share a little light how these two (cursor and playback_rate) are to be used?
In this case I want to have control over the play cursor but on any animation of choice.
I haven’t been very involved in developing this feature, so @Johan_Beck-Noren or @sven could probably fill in and/or verify. From our discussions my understanding is that when you’re playing an animation thought play_anim you are basically handing over control of the cursor to the animation system. go.PLAYBACK_ONCE_FORWARD should be seen as a convenience function to be used when you really want to play something forward once, the same goes for the other playback modes.
If you require additional control over the animations you should animate the cursor in the update function.
Yes, I understand that play_anim is taking control over the cursor. Problem is that I cannot find any other way to set the animation id.
Are there any undocumented constant that I can set with go.set(#spinemodel", “animation_id”)?? In this case I can settle with using offset on play_anim.
I’m just curious how to set an animation id before manually controlling the cursor.
Setting cursor or playback rate only affects the current animation that has been started with spine.play_anim.
I am not currently at my desktop but looking at your example above, using a table like {playback_rate = 1.0, offset=1.0} should in the case of ONCE_FORWARD simply place the cursor at the end and not play from the beginning.
So when changing animations the playback_rate and offset properties need to be set in the table for each call to spine.play_anim.
Thank you
With that particular case I could get away with offsetting to 1.0. Still I have questions.
It’s easier if I give you a user case:
I have an idle standing player. (using a looping animation “player_idle” with play_anim )
I want to start the running animation but controlling the cursor by accelerate the running animation. This I can do manually by “animating” the cursor with an sinus ease.
But how do I switch over to the running animation? I play a super quick spine.play_anim that ends next frame and then I can start controlling it?
Also I don’t find any user case for go.set("#spinemodel", “playback_rate”, 5). I really don’t understand where I should use it.
In that case I would start the running animation that you want to ease with a sine curve with {playback_rate = 0}, this will start the animation from the first frame but paused. And then animate the cursor with go.animate. Once the cursor sine animation finishes you can get the current cursor value, and use that value in the table for another call to play_anim, like
This should result in transitioning from you custom cursor-animated running animation to “regular” playback without any jump or discontinuity in cursor value for the switch.
EDIT: I haven’t tested the code, so it may not like copy-paste
Yes it works well!
I guess some kind of go.set("#spinemodel", “anim_id”, “running_animation”) would feel more accurate as it feels weird starting an never ending animation.
eg.
go.set("#spinemodel", “animation_id”, “running”)
go.set("#spinemodel", “cursor”, 0)
– and then handle manual cursor animations.