Open memmaker opened 11 months ago
No problem, thanks for using it~
If I'm understanding your request, you can just use whatever delta time-measuring functions you normally have at your disposal (a global delta time variable or function, calculating 1/TPS for Ebitengine, etc). Yielding in a coroutine pauses execution for some amount of time, but that doesn't change the delta value between game frames.
QUICK EDIT: To give an example, if you have this animation coroutine, then you could use YieldFunc
to create a function literal that yields execution until the animation is finished. You can call update on the animation in that literal, and pass whatever delta calculation / constant / value you normally would.
Thanks for this nice little piece of code :)
My use-case is this: I have an animation coroutine that has different stages, like it plays one animation after another. One of them is a simple simple LERPed rotation. However, that LERP function needs the delta time of the update. Is there an easy way to achieve what I want, that I just haven't figured out? If not, maybe you could add a small function like
YieldDeltaFunc(deltaFunc func(deltaTime float64) bool) error