Pause LuaRenderObject animation

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
User avatar
jurgy
Inserter
Inserter
Posts: 48
Joined: Wed Feb 27, 2019 5:55 pm
Contact:

Pause LuaRenderObject animation

Post by jurgy »

Hi,

I wish there was an easier way to pause animations of LuaRenderObjects.

Setting the animation_speed field to 0, jumps the animation to the first frame and later if you increase the speed again the animation jumps to the frame as if the animation was never paused.

It is possible to account for this by using the tick the animation was started at, then when pausing calculating the current frame it's at, set that as the animation_offset and then when starting the animation again calculate the number of ticks the animation was paused and adjust the offset again accordingly but this is a fairly elaborate process and it would be really helpful if the API supported this natively.

Thanks!
curiosity
Filter Inserter
Filter Inserter
Posts: 728
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Pause LuaRenderObject animation

Post by curiosity »

Would be great if it recalculated the offset to preserve the current frame instead of a dedicated pause function. Then it will work for any change of speed.
User avatar
jurgy
Inserter
Inserter
Posts: 48
Joined: Wed Feb 27, 2019 5:55 pm
Contact:

Re: Pause LuaRenderObject animation

Post by jurgy »

curiosity wrote: Sun Mar 09, 2025 12:42 pm Would be great if it recalculated the offset to preserve the current frame instead of a dedicated pause function. Then it will work for any change of speed.
Yeah, that's a better idea, I guess
User avatar
jurgy
Inserter
Inserter
Posts: 48
Joined: Wed Feb 27, 2019 5:55 pm
Contact:

Re: Pause LuaRenderObject animation

Post by jurgy »

I'm back once again to humbly request considering this change for LuaRenderObjects.

It can maybe be combined with this request from Quezler:
viewtopic.php?p=631766
Where creating an animation object always starts at frame 0 (excluding using frame offset).

A related issue is that when the animation speed is changed, the animation jumps to a seemingly random* frame. I think it would be great if this was changed such that changing the speed recalculates the offset so the animation stays on the same frame. If that were to be implemented, pausing the animation by setting the speed to 0 would work correctly "for free".

Please and thank you!


*) I know it's not random, it jumps to the frame it would've been on the given tick assuming the animation was always running at that speed starting from game tick 0.

P.s. Could you also please expose the animation prototypes in the runtime prototype object as mentioned in my other thread:
viewtopic.php?t=127357
Last edited by jurgy on Sat Jun 06, 2026 10:02 pm, edited 1 time in total.
User avatar
protocol_1903
Filter Inserter
Filter Inserter
Posts: 512
Joined: Fri Sep 09, 2022 4:33 pm
Contact:

Re: Pause LuaRenderObject animation

Post by protocol_1903 »

+1
pY and pYblock developer, wielder of fluid networks and subtick events in arbitrary ways. I make mods. Check them out, maybe.
https://mods.factorio.com/user/protocol_1903

Buy me a coffee
User avatar
Osmo
Filter Inserter
Filter Inserter
Posts: 312
Joined: Wed Oct 23, 2024 12:08 pm
Contact:

Re: Pause LuaRenderObject animation

Post by Osmo »

+1 to both requests, i actually want to be able to pause animations, for example when the animation is used to represent multiple rotations, so a frame can be set and animation paused, without having to update it each tick, which can obviously get expensive pretty fast.
Post Reply

Return to “Modding interface requests”