feat: 코디 일교차 8도 이상이면 겉옷을 5번째 옷으로 그림·이름표에 포함(-outer 그림), 그림 프롬프트에 적힌 옷만 그리기 규칙, warm 꾸안꾸 겉옷 그림 4장
This commit is contained in:
1 parent
368a576bdb
commit
aa9f22a166
11 files changed
+90
-31
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 97 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 58 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 65 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 59 KiB |
@@ -156,6 +156,13 @@
|
||||
.ootd-labels span:nth-child(even) {
|
||||
justify-self: end;
|
||||
}
|
||||
/* 겉옷(5번째) 이름표는 위 가운데 */
|
||||
.ootd-labels span:nth-child(5) {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
.ootd-labels span {
|
||||
padding: 8px 20px;
|
||||
border-radius: 99px;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { CardData } from './data'
|
||||
import { gakArt } from './gaks'
|
||||
import { hasTarotBg } from './templates'
|
||||
import { ootdBand, ootdOutfits } from './ootd'
|
||||
import { needsOuter, ootdOutfits } from './ootd'
|
||||
import type { Copy } from './templates'
|
||||
|
||||
export type ImageNeed = { kind: string; ids: string[] }
|
||||
@@ -9,11 +9,9 @@ export type ImageNeed = { kind: string; ids: string[] }
|
||||
/** 이 카드에 필요한 그림 중 아직 없는 것 (all 이면 전부). kind 는 image-prompts/<kind>.json, 그날 필요한 것만 Codex로 만든다. 타로는 그날 뽑힌 각 카드 그림 */
|
||||
export function neededImages(templateId: string, d: CardData, copy: Copy, all = false): ImageNeed[] {
|
||||
if (templateId === 'ootd') {
|
||||
const style = copy.style || 'casual'
|
||||
const band = ootdBand(d.maxC).id
|
||||
const ids = ootdOutfits(d.maxC, style)
|
||||
const ids = ootdOutfits(d.maxC, copy.style, undefined, needsOuter(d.maxC, d.morningC))
|
||||
.filter((o) => all || !o.image)
|
||||
.map((o) => `${band}-${o.persona}-${style}`)
|
||||
.map((o) => o.imageId)
|
||||
return ids.length ? [{ kind: 'ootd', ids }] : []
|
||||
}
|
||||
if (templateId === 'tarot') {
|
||||
|
||||
+18
-6
@@ -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`],
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import stillNight from '../assets/intro/still-night.webp'
|
||||
import type { CardData } from './data'
|
||||
import { Frame, Lines } from './Frame'
|
||||
import { tidy } from './text'
|
||||
import { DEFAULT_STYLE, ootdBand, ootdOutfits, styleLabel } from './ootd'
|
||||
import { DEFAULT_STYLE, needsOuter, ootdBand, ootdOutfits, styleLabel } from './ootd'
|
||||
import { gakArt, gakByCode } from './gaks'
|
||||
|
||||
// 대주제(skin)마다 한 번 만든 배경 그림 (npm run gen-image -- tarot-bg <skin>). 없으면 민무늬 배경
|
||||
@@ -51,6 +51,7 @@ const ootd: Template = {
|
||||
'서울(중구) 오늘 예보의 아침 6시~밤 9시 중 가장 높은 기온으로 7개 구간(28도 이상 · 23 · 17 · 12 · 9 · 5 · 그 아래) 중 하나를 고른다.',
|
||||
'스타일(캐주얼·세미정장·정장·스트릿·꾸안꾸)을 고르면 바로 그 옷으로 바뀐다. Claude 기획은 쓰지 않는다.',
|
||||
'구간 × 스타일 × 사람(20-30대·40대~ 여자·남자)마다 옷 4가지가 image-prompts/ootd.json에 정해져 있고, 같은 파일의 문장으로 Codex가 그린 그림(src/assets/ootd/<구간>-<사람>-<스타일>.webp)을 붙인다. 그림이 없으면 옷 이름만 나간다.',
|
||||
'아침·낮 기온 차가 8도 이상이면 겉옷을 5번째 옷으로 그린 그림(<구간>-<사람>-<스타일>-outer.webp)을 쓰고 이름표에도 겉옷을 더한다.',
|
||||
'카드에 지역 이름은 넣지 않는다.',
|
||||
],
|
||||
fields: [{ key: 'title', label: '제목 (사람·스타일 뒤에 붙음)' }],
|
||||
@@ -64,14 +65,14 @@ const ootd: Template = {
|
||||
hashtags: '#날씨각 #오늘의코디 #OOTD #데일리룩 #옷차림 #코디추천 #날씨 #오늘날씨 #서울날씨 #일상',
|
||||
}),
|
||||
warnings: (d, c) => {
|
||||
const missing = ootdOutfits(d.maxC, c.style).filter((o) => !o.image)
|
||||
const missing = ootdOutfits(d.maxC, c.style, undefined, needsOuter(d.maxC, d.morningC)).filter((o) => !o.image)
|
||||
const id = `${ootdBand(d.maxC).id}`
|
||||
return missing.length
|
||||
? [`낮 최고 ${d.maxC}도 · ${styleLabel(c.style)}에 ${missing.map((o) => o.label).join(', ')} 옷 그림이 아직 없어요. 옷 이름만 나갑니다. (npm run gen-image -- ootd ${id} ${c.style ?? DEFAULT_STYLE})`]
|
||||
: []
|
||||
},
|
||||
slides: (d, c) =>
|
||||
ootdOutfits(d.maxC, c.style, c.band).map((o, i, all) => (
|
||||
ootdOutfits(d.maxC, c.style, c.band, needsOuter(d.maxC, d.morningC)).map((o, i, all) => (
|
||||
<Frame page={i} total={all.length} theme={c.theme} className="ootd" key={o.persona}>
|
||||
<p className="meta">{d.dateLabel} · 오늘의 코디</p>
|
||||
<h1 className="ootd-title">
|
||||
|
||||
Reference in new issue
Block a user