User:Davidjcobb

Given

$$\begin{align} t & = \text{time since the shader was applied} \\ a_\text{full} & = \text{Full Alpha Ratio} \\ a_\text{persistent} & = \text{Persistent Alpha Ratio} \\ a_\text{offset} & = a_\text{full} - a_\text{persistent} \\ t_\text{fade-in} & = \text{Alpha Fade In Time} \\ t_\text{full} & = \text{Alpha Fade In Time} + \text{Full Alpha Time} \\ t_\text{fade-out} & = \text{Alpha Fade Out Time} \\ t_\text{end} & = \text{time at which the shader was removed} \\ t_\text{freq} & = \text{Alpha Pulse Frequency} \end{align} $$

the base alpha is defined as

$$ a_\text{base} = \begin{cases} a_\text{full}\times\dfrac{t}{t_\text{fade-in}}, & \text{if }t_\text{fade-in} > 0 \text{ and } t\le t_\text{fade-in} \\ a_\text{full}, & \text{if }t_\text{fade-in} = 0 \text{ and } t = 0 \\ a_\text{full}, & \text{if }t_\text{full}\ge t > t_\text{fade-in} \\ a_\text{persistent}+(a_\text{offset}\times\dfrac{t-t_\text{full}}{t_\text{fade-out}}), & \text{if }t_\text{full} + t_\text{fade-out} > t > t_\text{full} \\ a_\text{persistent}\times\dfrac{t-t_\text{end}}{t_\text{fade-out}}, & \text{if }t_\text{fade-out} > 0\text{ and }t > t_\text{end} \\ 0, & \text{if }t_\text{fade-out} = 0\text{ and }t\ge t_\text{end} \end{cases} $$

and assuming that the alpha pulse uses a sine wave, the current alpha is

$$ a_\text{current} = a_\text{base} + sin * t_\text{freq} $$