export type AnimationLevel = 'standard' | 'lite' const LITE_BENCHMARK_THRESHOLD = 18 const LITE_DEVICE_MEMORY_GB = 3 export function resolveAnimationLevel(systemInfo?: WechatMiniprogram.SystemInfo): AnimationLevel { const info = systemInfo || wx.getSystemInfoSync() const benchmarkLevel = Number((info as WechatMiniprogram.SystemInfo & { benchmarkLevel?: number }).benchmarkLevel) const deviceMemory = Number((info as WechatMiniprogram.SystemInfo & { deviceMemory?: number }).deviceMemory) if (Number.isFinite(benchmarkLevel) && benchmarkLevel > 0 && benchmarkLevel <= LITE_BENCHMARK_THRESHOLD) { return 'lite' } if (Number.isFinite(deviceMemory) && deviceMemory > 0 && deviceMemory <= LITE_DEVICE_MEMORY_GB) { return 'lite' } return 'standard' } export function formatAnimationLevelText(level: AnimationLevel): string { return level === 'lite' ? '精简' : '标准' }