import { getWrapper } from './getWrapper';
import { getSpinning } from './getSpinning';
/**
 Return a node that orbits around a central point.
  @example
  ```ts
  let cube: HNode = getPrefab({ p: [0, 0, 5] });
  cube = getOrbiting(cube);
  addTo(world, cube);
  ```
 */
export const getOrbiting = (target, options = {}) => {
    let { progress = 0, direction = -1, duration = 4, radius = 10, axis = 'x', p = undefined, r = undefined, s = undefined, } = options;
    // Define the offset based on the axis.
    let offset;
    switch (axis) {
        case 'x':
            offset = [radius, 0, 0];
            break;
        case 'y':
            offset = [0, radius, 0];
            break;
        case 'z':
            offset = [0, 0, radius];
            break;
    }
    target.transform = target.transform || {};
    const rOrg = target.transform.rot;
    let wrapper = getWrapper(target, { p, r, s });
    target.transform.pos = offset;
    target.transform.rot = rOrg;
    wrapper = getSpinning(wrapper, { direction, duration, progress });
    return wrapper;
};
//# sourceMappingURL=getOrbiting.js.map