**Fading in**

`alpha='if(lt(t,t1),0,(t-t1)/t2)'`

`t1`

- start time (in seconds),`t2`

- length (in seconds).

**Fading out**

`alpha='if(lt(t,t1),1,(t2-(t-t1))/t2)'`

`t1`

- start time (in seconds),`t2`

- length (in seconds).

**Fading in and out**

`alpha='if(lt(t,t1),0,if(lt(t,t1+t2),(t-t1)/t2,if(lt(t,t1+t2+t3),1,if(lt(t,t1+t2+t3+t4),(t4-(t-t1-t2-t3))/t4,0))))'`

`t1`

- fade in start time (in seconds),`t2`

- fade in length (in seconds),`t3`

- time to keep fully opaque (in seconds),`t4`

- fade out length (in seconds).

If you happen to know a better way or shorter expressions, please let me know.

]]>