draw_animation animation speed value change offset?

Place to get help with not working mods / modding interface.
Post Reply
Salaramon
Manual Inserter
Manual Inserter
Posts: 2
Joined: Sun May 23, 2021 8:46 am
Contact:

draw_animation animation speed value change offset?

Post by Salaramon »

I am tying to run this animation on entity death, I want it only to be played once and to be able to change the animation speed per entity.
The problem is that it is randomly shifts the offset when changing the animation speed, and sometimes it even does shifts the offset for the same values. Does anyone know what the problem might be?

Code: Select all

	local variableAnimation = table.deepcopy(data.raw["explosion"]["nuke-explosion"].animations.hr_version)
	variableAnimation.name = "variableExplosion"
	variableAnimation.type = "animation"
	variableAnimation.dice_y = 0
	variableAnimation.priority = "extra-high"
	variableAnimation.animation_speed = 1
	variableAnimation.shift = {0,0}
	data:extend{variableAnimation}

Code: Select all

	local animationSpeed = 1
	local animationLife = 100
	local animationOffset = 0
	
	rendering.draw_animation{animation="variableExplosion", animation_speed=animationSpeed, target=position, time_to_live=animationLife, animation_offset = animationOffset, surface="nauvis"}

Salaramon
Manual Inserter
Manual Inserter
Posts: 2
Joined: Sun May 23, 2021 8:46 am
Contact:

Re: draw_animation animation speed value change offset?

Post by Salaramon »

I did some analysis and found a partial pattern in the animation_speed to offset, I hope this is to help for anyone. If anyone can deduce something more out from it or have a better approach then please share.

I hope the spreadsheet explains itself, otherwise don't hesitate to ask.
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Bilka
Factorio Staff
Factorio Staff
Posts: 3156
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: draw_animation animation speed value change offset?

Post by Bilka »

See 79522
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Post Reply

Return to “Modding help”