• Returns an expression that calculates an interpolated or extrapolated result between the result of first and second based on the result of third. The type of the result of the first two expressions should be the same. You can interpolate between numbers, points or colors. The type of the result of the last expression can be a number or of the same type as the first two. The last argument represents the fraction to use when interpolating or extrapolating.

      var _ = ExpressionFactory;
    //Evaluates to 83.
    var number : _.mix(_.number(47), _.number(83), _.number(1));
    //Evaluates to a point halfway between p1 and p2.
    var middle = _.mix(_.point(p1), _.point(p2), _.number(0.5));
    //Evaluates to a point for which the y-component is close to but not equal to the middle.
    var notTheMiddle = _.mix(_.point(p1), _.point(p2), _.point({x: 0.5, y: 0.4, z: 0.5}));

    Type Parameters

    • T extends string | number | Vector3

    Parameters

    • first: Expression<T>

      The first expression to evaluate. Should result in a number, point or color.

    • second: Expression<T>

      The second expression to evaluate. Should result in the same type as first.

    • third: Expression<number | T>

      The third expression to evaluate. Should result in the same type as first or a number. Represents the fraction. In range [0,1] for interpolation, <0 or >1 for extrapolation.

    Returns Expression<T>

    An expression that calculates an interpolated or extrapolated result between the result of first and second based on the result of third. Results in a number, point or color depending on the type of the operands. When a number is used with an other type, the operation is applied to the individual element values and the result is of the other type.