VMT Function to Reverse Animation at Last Frame?

Is there a function I can put in a VMT to reverse a multi-framed VTF once it reaches the last frame? i.e. 123432123432… etc.

You should be looking at materials proxies. I think there was an IF operand there. Would have to doublecheck though.

So if there was an IF operand, how would I go about using it? Would it work to assign the frame rate a negative value once it reached the last frame?
So if you had a 0-9 frame animation:


if (frame = 0) framerate = 5
    if (frame = 9) framerate = -5


Could I assign the displayed frame value to a sine wave, and let it serve as the frame rate?

you could try it. note that the sine is a curved function you’ll have a lil bogus frame times.

edit: tested. does it.

and… don’t use it as framerate but the frame variable itself. i’m sure you know that tho. :slight_smile:

I have to say, I don’t know. I’m pretty new at this. Could you paste your code here?
Thanks!

O_o okay. i thought you know what you do. asking for sine proxy and stuff. but… well…

on canvas tested in sfm.



vertexlitgeneric
{
	$basetexture "dev\ekg_anim"

	proxies
	{
		sine
		{
			sineperiod			3
			sinemin				0
			sinemax				24
			timeoffset			0
			resultvar			$frame
		}	
	} 			
}


need more explanation? you should not.

edit: just for the correctness. removed the animatedtexture proxy. it’s not even needed. and the $frame is a shader parameter. damnit.

Fantastic, that makes perfect sense. Thank you!