Page 1 of 1

draw_animation animation speed value change offset?

Posted: Sun May 23, 2021 11:30 am
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"}

Re: draw_animation animation speed value change offset?

Posted: Wed May 26, 2021 5:08 pm
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

Re: draw_animation animation speed value change offset?

Posted: Wed May 26, 2021 5:21 pm
by Bilka
See 79522