Description
The FromLerp
method is a virtual method in the Sandbox.UI.BaseStyles
class. It is used to interpolate between two BaseStyles
instances based on a given delta value. This method allows for smooth transitions between different style states, which can be useful for animations or gradual style changes.
Usage
To use the FromLerp
method, you need to have two instances of BaseStyles
that represent the starting and ending styles. You also need a float
value for delta
, which should be between 0 and 1, representing the interpolation factor. A delta
of 0 will result in the from
styles, while a delta
of 1 will result in the to
styles.
Example
// Example usage of FromLerp method
BaseStyles startStyles = new BaseStyles();
BaseStyles endStyles = new BaseStyles();
// Configure start and end styles
startStyles.Width = new Length(100, LengthUnit.Pixel);
endStyles.Width = new Length(200, LengthUnit.Pixel);
// Interpolate between start and end styles
BaseStyles currentStyles = new BaseStyles();
currentStyles.FromLerp(startStyles, endStyles, 0.5f); // Interpolates to a width of 150px