# "playback\_rate" for sprites doesn't work

**URL:** <https://forum.defold.com/t/playback-rate-for-sprites-doesnt-work/52032>\
**Category:** Bugs\
**Created:** [May 13, 2019, 5:29pm UTC](https://forum.defold.com/t/playback-rate-for-sprites-doesnt-work/52032 "2019-05-13T17:29:14Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Pkeod](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pkeod/32/606_2.png) [@Pkeod](https://forum.defold.com/u/Pkeod)\
**Post date:** [May 14, 2019, 12:17am UTC](https://forum.defold.com/t/playback-rate-for-sprites-doesnt-work/52032/3 "2019-05-14T00:17:01Z")

</div>

How exactly are you writing the code?

> [@Defold 1.2.151 has been released](https://forum.defold.com/t/defold-1-2-151-has-been-released/49385/7):
>
> How does this work? I tried setting cursor property values but nothing changes. playback\_rate does seem to work fine. function init(self) local num = math.random(30) print(num) go.set("#sprite", "playback\_rate",math.random(num)) end Got it working function init(self) local num = math.random(30) / 30 print(num) sprite.play\_flipbook("#sprite", "spin", nil, {offset = num}) end Has to be a value between 0-1? And has to be used on play\_flipbook also it’s called offset not cursor. playba…

Does seem like some weird things are going on

[SpritePlaybackRate.zip](https://defold-forum-bucket.nbg1.your-objectstorage.com/original/2X/d/d924e30b690cb78a16a6e32467656bd5095798ba.zip) (3.7 KB)

```lua
	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.

---

_[View the full topic](https://forum.defold.com/t/playback-rate-for-sprites-doesnt-work/52032)._
