Flipbook Material : fade in and fade out

I’m trying to make a fog sheet, which applies a flipbook material; I used the smoke subUV texture in official Particle Effects map, which looks like this:

the alpha channel:
(I know many may have seen this texture since it’s in official example, but still post it for clarity)

When I first time made this material and apply it, it seems unnatural, since it looped from the last picture of texture to the first one and the two ends doesn’t get quite seamless, so I tried to make the material fade in and fade out in these two ends using Opacity. I made a function which multiplies the opacity in the process to control its value, and I set the purpose of this function to be like “go to 0 when the phase of animation is at two ends; go to 1 when it’s in the middle; parabolic curve.”, so the functions looks like this:
(I know it’s kinda high school math so easy for many, but I kinda forget about high school math…so I’m not totally sure it’s a right function for the curve I want…but I did take some digits into it and it looks correct on paper.)

When I first applied this function it first subtracted 0.5 then multiplied by 2, then went on to a power of 2(or multiple of 2), multiplied by -1 then add 1, thus creating a parabolic that goes from 0 to 1 when the input time phase is 0~0.5 and goes down from 1 to 0 when the input time phase is 0.5~1.

The time input looks like this:
The flipbook function input:

But the result is somewhat wrong, it didn’t go as I expected and fade out at the end of animation, but rather goes back to full opacity…so the result is, the animation is still inconsistent when it looped back to the starting point…

I don’t really understand what’s wrong, I guess it’s because of the time input, which go through frac node and will not reach 1 forever…it only goes back to 0 when it reaches 1…so I guess that I subtracted 0.5 is wrong, and thus I get the first two steps of the function to change to “minus 0.9999/2, and multiply by 2/0.9999”…but the result is still the same.

Now, again I checked out the whole material nodes and find another possible solution: on the flipbook function there is a boolean input which can clamp the time fraction input from 0~1 to 0~0.9999, but after I input a true bool node to it the result got disappointingly… the same.

So that is why I decided to get the problem on the forum and see if here will be some answers for me. I don’t understand what goes wrong and how to fix it.

No one answered? I thought this wouldn’t be hard…I just need a reminder that I might misunderstood something.