InterpolateWith

const Rgba &otherColor, float factor ) const;

Returns a mixed color between this and otherColor using the given factor.

The factor should be between 0.0 and 1.0. If factor is zero, InterpolateWith returns the calling color and if factor is 1.0 it returns the given otherColor. But if the factor is between 0.0 and 1.0 it returns a mix of the two colors.

The lower the factor, the closer the returned color is to the calling color and higher the factor, the closer the returned color is to the given otherColor.

Examples

// Get a color half way between red and blue //
Rgba magneta = Rgba::RED.InterpolateWithRgba::BLUE, 0.5 );

// Get a slightly darker blue color //
Rgba darkerBlue = Rgba::BLUE.InterpolateWithRgba::BLACK, 0.2 );

// Get a mixed color between magneta and darkerBlue which is slightly closer to darkerBlue than magneta //
Rgba mixedColor = magneta.InterpolateWith( darkerBlue, 0.6 );


Other functions of the class Rgba
InterpolateWith
Mixes two colors together with the given factor

Advanced functions

Packed
Select


Questions about InterpolateWith? Click here.