Description
The WithAlphaMultiplied
method of the Color
struct returns a new Color
instance with its alpha component multiplied by the specified factor. This method is useful when you want to adjust the transparency of a color by a certain multiplier without altering the original color object.
Usage
To use the WithAlphaMultiplied
method, call it on an instance of Color
and pass a float
value representing the multiplier for the alpha component. The method returns a new Color
object with the adjusted alpha value.
Example
// Example of using WithAlphaMultiplied
Color originalColor = new Color(0.5f, 0.5f, 0.5f, 0.8f);
float alphaMultiplier = 0.5f;
Color newColor = originalColor.WithAlphaMultiplied(alphaMultiplier);
// newColor now has an alpha of 0.4 (0.8 * 0.5)