Particle FadeIn-FadeOut

How to fade in particles, and then fade them out, using script?
I can only fade out, but I’m not being able to do the fade in step.

@MartinBerisso has a solution in this thread: Fade particles before they die - #5 by MartinBerisso

And also here’s a quick demo project
spark-particle-fade-in-out.arexport (37.0 KB)