fix: 로그인 등 아래 창이 버벅이던 문제 — 해·구름 떨어짐과 둥둥을 다른 요소로 나눠 GPU로 넘기고(둘이 겹쳐 매 프레임 메인 스레드 작업), 낮엔 안 보이는 별 애니메이션 멈춤, 창이 열린 동안 뒤 화면 움직임 정지
This commit is contained in:
1 parent
bfbf6da101
commit
14f24d1ab0
6 files changed
+26
-10
No files matched your search
@@ -87,7 +87,7 @@ function Big({ children, className }: { children: ReactNode; className?: string
|
||||
function Pic({ name, className }: { name: string; className?: string }) {
|
||||
return (
|
||||
<span className={cx('b-fall pointer-events-none absolute top-[30%] right-3.5 w-[42%]', className)} style={fall('.1s', '5s')}>
|
||||
<Ic name={name} className="w-full drop-shadow-[0_16px_18px_rgb(40_48_74/0.18)]" />
|
||||
<Ic name={name} className="b-bob w-full drop-shadow-[0_16px_18px_rgb(40_48_74/0.18)]" />
|
||||
</span>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ export function SeasonPage() {
|
||||
<p className="m-0 text-[13px] font-extrabold opacity-75">이번 주 특집{w.start && w.end ? ` · ${dateRange(w.start, w.end)}` : ''}</p>
|
||||
<p className="mt-1 max-w-[62%] font-jua text-[29px] leading-tight">{w.headline}</p>
|
||||
<span className="b-fall pointer-events-none absolute top-[18%] right-3.5 w-[38%]" style={fall('.1s')}>
|
||||
<Ic name="maple" className="w-full drop-shadow-[0_16px_18px_rgb(40_48_74/0.18)]" />
|
||||
<Ic name="maple" className="b-bob w-full drop-shadow-[0_16px_18px_rgb(40_48_74/0.18)]" />
|
||||
</span>
|
||||
{(w.poem_lines ?? []).length > 0 && (
|
||||
<p className="mt-auto max-w-[72%] pt-3 font-batang text-[22px] leading-[1.7]">
|
||||
|
||||
@@ -101,8 +101,10 @@ function SheetHost({ state, onClose }: { state: SheetState; onClose: () => void
|
||||
const root = document.documentElement
|
||||
const before = root.style.overflow
|
||||
root.style.overflow = 'hidden'
|
||||
root.classList.add('b-sheet-open')
|
||||
return () => {
|
||||
root.style.overflow = before
|
||||
root.classList.remove('b-sheet-open')
|
||||
}
|
||||
}, [isOpen])
|
||||
|
||||
|
||||
@@ -199,9 +199,12 @@ function Hero({ hero, today, ranked, all, feedLoad, todayLoad }: HeroProps) {
|
||||
</div>
|
||||
<div className="relative h-[146px]">
|
||||
{CLOUDS.slice(0, CLOUD_N[weather]).map((c) => (
|
||||
<span key={c.cls} className={cx('b-cloud b-fall z-[1]', c.cls)} style={fall(c.d, c.f)} aria-hidden="true" />
|
||||
<span key={c.cls} className={cx('b-fall absolute z-[1]', c.cls)} style={fall(c.d, c.f)} aria-hidden="true">
|
||||
<span className="b-cloud b-bob inset-0" />
|
||||
</span>
|
||||
))}
|
||||
<div className="b-sun b-fall absolute top-2 left-1/2 -ml-16 grid aspect-square w-32 place-items-center rounded-full text-center" style={fall('0s', '5.6s', '8px')}>
|
||||
<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">
|
||||
@@ -223,6 +226,7 @@ function Hero({ hero, today, ranked, all, feedLoad, todayLoad }: HeroProps) {
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="relative z-[3] text-center">
|
||||
{top1 ? (
|
||||
|
||||
+15
-5
@@ -22,11 +22,12 @@
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* 하늘에서 떨어진 뒤 둥둥 */
|
||||
/* 하늘에서 떨어진 뒤(.b-fall) 둥둥(.b-bob, 그 안쪽 요소). 한 요소에 transform 애니메이션 둘이 겹치면 GPU로 못 넘겨 매 프레임 메인 스레드가 일한다 */
|
||||
.b-fall {
|
||||
animation:
|
||||
b-drop 1.05s cubic-bezier(0.22, 0.9, 0.3, 1) var(--d, 0s) both,
|
||||
b-float var(--f, 4.8s) ease-in-out calc(var(--d, 0s) + 1.05s) infinite;
|
||||
animation: b-drop 1.05s cubic-bezier(0.22, 0.9, 0.3, 1) var(--d, 0s) backwards;
|
||||
}
|
||||
.b-bob {
|
||||
animation: b-float var(--f, 4.8s) ease-in-out calc(var(--d, 0s) + 1.05s) infinite;
|
||||
}
|
||||
@keyframes b-drop {
|
||||
0% {
|
||||
@@ -53,7 +54,7 @@
|
||||
transform: translateY(0);
|
||||
}
|
||||
50% {
|
||||
transform: translateY(calc(var(--amp, 9px) * -1)) rotate(var(--tilt, 1.2deg));
|
||||
transform: translateY(-9px) rotate(1.2deg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -509,6 +510,9 @@
|
||||
border-radius: 50%;
|
||||
background: #fff;
|
||||
box-shadow: 0 0 6px rgb(255 255 255 / 0.8);
|
||||
}
|
||||
/* 별은 밤에만 보이니 반짝임·별똥별도 밤에만 돌린다 (낮에 안 보이는 채로 돌면 매 프레임 일을 한다) */
|
||||
.b-skybg[data-t='night'] .b-skystars i {
|
||||
animation: b-twinkle var(--tw, 5s) ease-in-out infinite;
|
||||
animation-delay: var(--dl, 0s);
|
||||
}
|
||||
@@ -523,8 +527,14 @@
|
||||
border-radius: 2px;
|
||||
background: linear-gradient(90deg, rgb(255 255 255 / 0), #fff);
|
||||
opacity: 0;
|
||||
}
|
||||
:is(.b-skybg, .b-hero)[data-t='night'] .b-shoot {
|
||||
animation: b-shoot var(--dur, 8s) ease-in var(--dl, 0s) infinite;
|
||||
}
|
||||
/* 아래 창이 열려 있는 동안 뒤 화면 움직임은 멈춘다 (창이 버벅이지 않게) */
|
||||
html.b-sheet-open .b-app :is(.b-fall, .b-bob, .b-blob, .b-skystars i, .b-shoot, .b-stars i) {
|
||||
animation-play-state: paused !important;
|
||||
}
|
||||
@keyframes b-shoot {
|
||||
0%, 86% { opacity: 0; transform: rotate(-24deg) translateX(0); }
|
||||
89% { opacity: 1; }
|
||||
|
||||
@@ -39,7 +39,7 @@ export const MOODS = [
|
||||
|
||||
export const moodEmoji = (mood?: string | null) => MOODS.find(([k]) => k === mood)?.[1]
|
||||
|
||||
export const fall = (d: string, f = '4.8s', amp?: string) => ({ '--d': d, '--f': f, ...(amp ? { '--amp': amp } : {}) }) as CSSProperties
|
||||
export const fall = (d: string, f = '4.8s') => ({ '--d': d, '--f': f }) as CSSProperties
|
||||
|
||||
export const WEEKDAYS = ['일', '월', '화', '수', '목', '금', '토'] as const
|
||||
|
||||
|
||||
Reference in new issue
Block a user