feat: 코디 일교차 8도 이상이면 겉옷을 5번째 옷으로 그림·이름표에 포함(-outer 그림), 그림 프롬프트에 적힌 옷만 그리기 규칙, warm 꾸안꾸 겉옷 그림 4장

This commit is contained in:
minaChoi committed 2026-10-25 15:08:51 +09:00
1 parent 368a576bdb
commit aa9f22a166
11 files changed
+90 -31

No files matched your search

+18 -6
View File
@@ -1,8 +1,9 @@
import spec from '../../image-prompts/ootd.json'
/** 낮 최고기온 구간 × 스타일 × 사람별 옷. 옷 목록·카드 글자는 image-prompts/ootd.json 한 곳에서 정한다.
* 그림은 src/assets/ootd/<구간>-<사람>-<스타일>.webp 가 있으면 자동으로 붙는다 (npm run gen-image -- ootd <구간|스타일>) */
export type Outfit = { persona: string; label: string; labels: string[]; outer: string; image?: string }
* 그림은 src/assets/ootd/<구간>-<사람>-<스타일>.webp 가 있으면 자동으로 붙는다 (npm run gen-image -- ootd <구간|스타일>).
* 일교차가 크면(OUTER_GAP_C 이상) 겉옷을 5번째 옷으로 그린 <구간>-<사람>-<스타일>-outer.webp 를 쓰고 이름표에도 겉옷을 더한다 */
export type Outfit = { persona: string; label: string; labels: string[]; outer: string; imageId: string; image?: string }
export type OotdBand = { id: string; from: number }
const IMAGES = import.meta.glob<string>('../assets/ootd/*.webp', { eager: true, import: 'default' })
@@ -18,17 +19,28 @@ export const styleLabel = (id?: string) => spec.styles[styleOf(id)].label
export const OOTD_BANDS: OotdBand[] = spec.bands.map((b) => ({ id: b.id, from: b.from }))
/** 아침·낮 기온 차가 이만큼이면 겉옷까지 보여 준다 (카드 날씨 줄의 '일교차 커요'와 같은 기준) */
export const OUTER_GAP_C = 8
export const needsOuter = (maxC: number, morningC: number) => maxC - morningC >= OUTER_GAP_C
export function ootdBand(maxC: number) {
return OOTD_BANDS.find((b) => maxC >= b.from) ?? OOTD_BANDS[OOTD_BANDS.length - 1]
}
/** 그 구간·스타일의 6명 옷 */
/** 그 구간·스타일의 6명 옷. bandId 를 주면 기온 대신 그 구간 (예시 카드용) */
export function ootdOutfits(maxC: number, style?: string, bandId?: string): Outfit[] {
/** 그 구간·스타일의 사람별 옷. bandId 를 주면 기온 대신 그 구간 (예시 카드용). withOuter 면 겉옷 포함 그림·이름표 */
export function ootdOutfits(maxC: number, style?: string, bandId?: string, withOuter = false): Outfit[] {
const band = spec.bands.find((b) => b.id === (bandId || ootdBand(maxC).id))!
const st = styleOf(style)
return PERSONAS.map((p) => {
const o = band.outfits[st][p]
return { persona: p, label: spec.personas[p].label, labels: o.labels, outer: o.outer, image: IMAGES[`../assets/ootd/${band.id}-${p}-${st}.webp`] }
const imageId = `${band.id}-${p}-${st}${withOuter ? '-outer' : ''}`
return {
persona: p,
label: spec.personas[p].label,
labels: withOuter ? [...o.labels, o.outer] : o.labels,
outer: o.outer,
imageId,
image: IMAGES[`../assets/ootd/${imageId}.webp`],
}
})
}