If you run animation with sprite.play_flipbook, setting property “playback_rate” does nothing.
This property only works for animation set in the editor, not in runtime.
How exactly are you writing the code?
Does seem like some weird things are going on
SpritePlaybackRate.zip (3.7 KB)
print(go.get("/a#sprite", "playback_rate"))
sprite.play_flipbook("/a#sprite", "a", nil, {playback_rate = 30})
go.set("/a#sprite", "playback_rate", 60)
print(go.get("/a#sprite", "playback_rate"))
If you do the above the rate will print as 1 and then 60 in the example I posted, but the actual rate will be 30. It looks like if you set a rate with sprite.play_flipbook properties and then do go.set to set the rate on the same frame the go.set value is ignored by the actual playback but isn’t by the print.
It’s actually that if you do sprite.play_flipbook you have to supply the playback_rate in its properties table because you cannot set it anywhere else on the same frame. On the next frame it works.
Yes, the code is that like in your example.
This is bug anyway. Animation system should accept the last rate set, no matter how and when it is set, same frame or not. If it report back the particular rate, it should play with that rate, no matter what.
As far as I understand this is as designed; internally the sprite.play_flipbook
function will result in play_animation
message. This means it will not update the playback_rate
property until the animation is actually started (when the sprite system receives and handles the message).
What is the use case when you need to get the playback_rate
of an animation that you self initiated?