import { EFFECT_NONE, allowAnimation, atmospherePoint, getPrimaryEffect, toMs } from "./utils/index.js";
import { flyInScatter, scaleInScatter } from "./utils/scatter.js";
const scatterAppear = (config)=>{
    if (!allowAnimation(config)) return false;
    const effect = getPrimaryEffect(config);
    const duration = toMs(config?.duration);
    const result = 'growth' === effect ? flyInScatter(duration, config?.ease) : 'scale' === effect ? scaleInScatter(duration, config?.ease) : [];
    return {
        point: result
    };
};
const scatterLoop = (config, ignoreFirstNormal)=>{
    if (!config?.enable) return false;
    const interval = config.interval ?? 0;
    const startTime = ignoreFirstNormal ? toMs(interval) : 0;
    const effect = getPrimaryEffect(config.loop);
    const loopDuration = effect === EFFECT_NONE ? 0 : 1000;
    const atmosphereDuration = effect === EFFECT_NONE ? 2000 : 1000;
    const result = [];
    if ('growth' === effect) result.push(...flyInScatter(loopDuration, config.loop?.ease, true, startTime, toMs(interval + 1)));
    else if ('scale' === effect) result.push(...scaleInScatter(loopDuration, config.loop?.ease, true, startTime, toMs(interval + 1)));
    if ((config.atmosphere?.effect ?? EFFECT_NONE) !== EFFECT_NONE) result.push({
        loop: true,
        startTime,
        delayAfter: toMs(interval),
        duration: atmosphereDuration,
        easing: config.atmosphere?.ease,
        ...atmospherePoint(config.atmosphere?.effect),
        controlOptions: {
            immediatelyApply: false
        }
    });
    return {
        point: result
    };
};
const scatterUpdate = (config)=>{
    if (!allowAnimation(config)) return false;
    return {
        point: {
            duration: toMs(config?.duration),
            easing: config?.ease
        }
    };
};
const scatterExit = (config)=>{
    if (!allowAnimation(config)) return false;
    return {
        point: {
            duration: toMs(config?.duration),
            easing: config?.ease
        }
    };
};
export { scatterAppear, scatterExit, scatterLoop, scatterUpdate };

//# sourceMappingURL=scatter.js.map