I'm writing a pixel shader that will be used to draw a slider type control that has min/max and current values.

Any pixel before the current value should be full colour (original texture alpha level), anything shortly after should gradually fade away, and anything far after the current value should be fully transparent.

Currently i have this code:
Code:
if (textureCoordinate.x < SliderValue)
    {
		return TileColour;
    }
    else if(textureCoordinate.x < SliderValue + (SliderValue / 10))
    {
		float Proportion = (SliderValue + (SliderValue / 10) - textureCoordinate.x) / (SliderValue / 10);
		
		return float4(TileColour.rgb, TileColour.a * Proportion);
    }
    else
    {
		return 0;
    }
However, conditionals are slow on a graphics card, so i'd ideally like to get this down to a single formula.

The SliderValue is in range 0 to 1, as are texture coordinates. The TileColour variable is the original texture colour. TileColour.a is the original alpha level of the texture (range 0..1, 0 for transparent).

The first part deals with pixels before the slider value.The last part deals with pixels far after the slider value,

The middle bit deals with pixels within a range shortly after the slider value (when the slider value is low this range is small, when the slider value is high the range is high). Basically i'm defining a range that's 1 tenth the size of the current slider value. Pixels within that range i want to fade from fully oblique to fully transparent.

This code produces the effect i want, but i'd like it in a single formula if possible.

Hopefully i've explained this enough to take away any need for knowledge of pixel shaders!!