Multiplying small numbers in shader causes strange behaviour

I’ve managed to implement it somehow: p5.js Web Editor

The effect is still not working the way I like, though. I don’t seem to have control of the fade duration beyond a certain point, even with very small numbers.