code: function getDirection(gradient) {
      var segs;
      var angle;
      var result = {};
  
      if (gradient.sideCorner) {
          segs = gradient.sideCorner.split(/\s+/);
  
          var to = segs[0] === 'to';
          if (to) {
              // sideCorner starts with "to" so we shift it off since we don't
              // need this element anymore, and continue with generating the
              // gradient in the normal direction.
              segs.shift();
          } else {
              // sideCorner does not start with "to", so we need to reverse the
              // direction.
              var reverseDirections = {
                  top: 'bottom',
                  bottom: 'top',
                  left: 'right',
                  right: 'left'
              };
              segs[0] = reverseDirections[segs[0]];
          }
  
          result.direction = segs[0];
          // side corner is  `top right` or `bottom left` etc.
          if (segs.length > 1) {
              // fallback to one direction
              result.isFallback = true;
              result.message =
                  'IE filter doesn\'t support side corner gradient, ' +
                  'we use the first side of the side corner as fallback.';
          }
      } else {
          angle = normalizeAngle(gradient.angle.value, gradient.angle.unit);
          result = angleToDirection(angle);
      }
  
      return result;
  }
docs: Get the gradient direction: left, right, top or bottom