feat: 달 포스트·히어로 달을 오늘 밤 실제 모양으로 — 표면 무늬·빛 번짐, 보름엔 가장 밝게, 저녁엔 노을빛, 달 포스트는 밤하늘·별 배경
This commit is contained in:
1 parent
fcc4163e15
commit
d32e24a5ab
8 files changed
+143
-24
No files matched your search
@@ -21,6 +21,7 @@ import { cardBg, kindOfHour, kst, type Load, loadOf, MEDALS, type TimeKind, WEEK
|
||||
import { fall } from './lib'
|
||||
import { FoliageCard } from './foliageMap'
|
||||
import { InstallBanner } from './installBanner'
|
||||
import { MoonArt } from './moon'
|
||||
import { MyGakRow } from './myGak'
|
||||
import { fromShare } from './myGakState'
|
||||
import { PostCard, PostCardSkel, PostFrame } from './Post'
|
||||
@@ -372,13 +373,9 @@ function Hero({ hero, post, today, ranked, all, feedLoad, todayLoad }: HeroProps
|
||||
</span>
|
||||
))}
|
||||
<div className={'b-fall absolute top-2 left-1/2 -ml-16 aspect-square w-32'} style={fall('0s', '5.6s')}>
|
||||
<div className="b-sun b-bob relative grid size-full place-items-center rounded-full text-center">
|
||||
{/* 안 보이는 쪽을 덮어 오늘 밤 달 모양으로 */}
|
||||
{moon && (
|
||||
<svg viewBox="-1 -1 2 2" className="pointer-events-none absolute inset-0 size-full" aria-hidden="true">
|
||||
<path d={moonPath(moon.pct, 1, false)} fill={kind === 'sunset' ? 'rgb(96 40 86 / .55)' : 'rgb(34 30 86 / .62)'} transform={moon.waning ? 'scale(-1,1)' : undefined} />
|
||||
</svg>
|
||||
)}
|
||||
<div className={cx('b-sun b-bob relative grid size-full place-items-center rounded-full text-center', moon && 'b-moon')}>
|
||||
{/* 오늘 밤 실제 모양의 달 (빛 번짐까지 그려서 공보다 크게) */}
|
||||
{moon && <MoonArt pct={moon.pct} waxing={!moon.waning} tone={kind === 'sunset' ? 'dusk' : 'night'} className="pointer-events-none absolute -top-1/4 -left-1/4 size-[150%] max-w-none" />}
|
||||
{/* 점수 근거가 있으면 해를 눌러도 근거 창: 구석 버튼은 구름에 가려져서 상태 줄 끝으로 옮김 */}
|
||||
{(() => {
|
||||
const body = (
|
||||
@@ -389,7 +386,8 @@ function Hero({ hero, post, today, ranked, all, feedLoad, todayLoad }: HeroProps
|
||||
<b className="block font-bagel text-[52px] leading-[0.95] font-normal">{heroVal(feedLoad, score, 'w-[84px]')}</b>
|
||||
</>
|
||||
)
|
||||
const cls = cx('relative', moon && '[text-shadow:0_0_6px_#fff,0_0_12px_#fff]')
|
||||
// 가운데가 밝은 달이면 진한 글씨에 흰 번짐, 가운데가 어두운 달(초승·그믐)이면 흰 글씨
|
||||
const cls = cx('relative', moon && (moon.pct >= 50 ? '[text-shadow:0_0_6px_#fff,0_0_12px_#fff]' : 'text-white [text-shadow:0_1px_8px_rgb(10_14_40/0.6)]'))
|
||||
if (!why || score == null) return <span className={cls}>{body}</span>
|
||||
return (
|
||||
<button
|
||||
@@ -470,16 +468,6 @@ function Hero({ hero, post, today, ranked, all, feedLoad, todayLoad }: HeroProps
|
||||
|
||||
const WANING = ['기우는 달', '하현달', '그믐달']
|
||||
|
||||
/**
|
||||
* 반지름 r 인 달에서 밝은 쪽(lit) 또는 어두운 쪽 경로. 차오르는 달 기준(오른쪽이 밝음), 기우는 달은 좌우를 뒤집어 쓴다.
|
||||
* 바깥 반원과 명암 경계(가로 반지름 r·|1-2k| 인 타원 호)로 이루어진다.
|
||||
*/
|
||||
function moonPath(pct: number, r: number, lit: boolean) {
|
||||
const k = pct / 100
|
||||
const edge = `A${r * Math.abs(1 - 2 * k)},${r} 0 0 ${k < 0.5 ? 0 : 1} 0,${-r}`
|
||||
return `M0,${-r} A${r},${r} 0 0 ${lit ? 1 : 0} 0,${r} ${edge}`
|
||||
}
|
||||
|
||||
function GakCard({ items, post, place, at }: { items: TopIndex[]; post?: PostReaction | null; place: string; at: string }) {
|
||||
const { open } = useSheet()
|
||||
const tplRef = useRef<HTMLDivElement>(null)
|
||||
|
||||
Reference in new issue
Block a user