import { each } from './each';
import { getRandomSeed } from './randomSeed';
import { setRotation } from './setRotation';
/**
 * Randomize rotation on specified axes. Value on axis will be randomized and added to existing rotation and will vary bot positive and negative. In the example below. the value will vary between -0.2 and 0.2, rotation in degrees
 * @param  target the object to apply random rotation to
 * @param  opt optional, the limitations of the random rotations, default will add a random 360 rotation on the Y axis.
 */
export const randomRotation = (target, opt = {}) => {
    opt = {
        limX: 0,
        limY: 180,
        limZ: 0,
        ...opt,
    };
    let rotOff = [0, 0, 0];
    each(opt, (val, key) => {
        let randVal = getRandomSeed().getValue();
        if (key === 'limX')
            rotOff[0] = randVal * val;
        if (key === 'limY')
            rotOff[1] = randVal * val;
        if (key === 'limZ')
            rotOff[2] = randVal * val;
    });
    setRotation(target, rotOff);
};
//# sourceMappingURL=randomRotation.js.map