atan2 static method

Value atan2(
  1. Object y,
  2. Object? x
)

Creates a atan2() calculation for y and x.

Each argument must be either a SassNumber, a SassCalculation, an unquoted SassString, or a CalculationOperation.

This automatically simplifies the calculation, so it may return a SassNumber rather than a SassCalculation. It throws an exception if it can determine that the calculation will definitely produce invalid CSS.

This may be passed fewer than two arguments, but only if one of the arguments is an unquoted var() string.

Implementation

static Value atan2(Object y, Object? x) {
  y = _simplify(y);
  x = x.andThen(_simplify);
  var args = [y, if (x != null) x];
  _verifyLength(args, 2);
  _verifyCompatibleNumbers(args);
  if (y is! SassNumber ||
      x is! SassNumber ||
      y.hasUnit('%') ||
      x.hasUnit('%') ||
      !y.hasCompatibleUnits(x)) {
    return SassCalculation._("atan2", args);
  }
  return number_lib.atan2(y, x);
}