Material that interpolates to TargetValue over time

I’m trying to make a material that smoothly interpolates to a TargetValue over a period of time.

Example:
At first TargetValue is 0
When TargetValue changes to 1, smoothly interpolate to 1 over time, and stop
When TargetValue changes back to 0, smoothly interpolate to 0 over time, and stop

This is my current approach so far (image). In blueprint I’d use a CurrentValue and interpolate it to TargetValue, but I don’t see a way to store a variable in a material.

Any tips or guesses? Or perhaps this isn’t possible at all?

Thanks!

image

Technically, you can do anything you want in a material, but you do reach a point of dimishing returns.

This would be much easier to do using a blueprint which is controlling the parameter with a timeline.