07시도 기록 흐림 목록 — 새 시도가 쌓일 때마다 오래된 기록일수록 투명도 값이 낮아지는 방식
새 시도 기록이 하나 쌓일 때마다 그 이전 기록들의 투명도 값이 한 단계씩 낮아집니다.
쓰임로그인 기록 화면, 계정 보안 점검 리포트 화면
MAX_ENTRIESOPACITY_STEPMIN_OPACITY

<main class="stage">
<div class="ahf is-demo" id="ahf">
<button class="ahf__btn" id="ahfBtn" type="button">로그인 시도 추가</button>
<ul class="ahf__list" id="ahfList"></ul>
</div>
</main>@use "../../../../site/static/demo-tokens" as *;
// 계산 겹: i번째(0=최신) 기록의 불투명도 = max(최소, 1 − i×STEP) — index.html 참조
@include stage($stage-orange);
.ahf {
width: 100%;
max-width: 300px;
display: grid;
gap: $sp-3;
justify-items: center;
}
.ahf__btn {
border: 0;
border-radius: $r-control;
padding: $sp-2 $sp-4;
background: $stage-ink;
color: $subject-cream;
font: 700 13px/1 -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
cursor: pointer;
transition: transform $dur-instant $ease-out;
&:active { transform: scale(.96); }
}
.ahf__list {
width: 100%;
list-style: none;
margin: 0;
padding: 0;
display: grid;
gap: $sp-2;
}
.ahf__row {
display: flex;
align-items: center;
justify-content: space-between;
padding: $sp-2 $sp-3;
border-radius: $r-sm;
background: $subject-cream;
font: 600 12px/1 -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
animation: ahf-in $dur-quick $ease-out backwards;
}
@keyframes ahf-in {
from { transform: translateY(-8px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
.ahf__time { color: rgba($stage-ink, .6); }
.ahf__result { color: $stage-ink; }
.ahf__row--fail .ahf__result { color: $error; }
.ahf__row--ok .ahf__result { color: $subject-blue-deep; }
@media (max-width: 340px) {
.ahf { max-width: 220px; }
.ahf__row { font-size: 11px; padding: $sp-2 $sp-2; }
}
@media (prefers-reduced-motion: reduce) {
.ahf__btn { transition: none; }
.ahf__row { animation: none; }
}html, body {
margin: 0;
overflow: hidden;
}
.stage {
box-sizing: border-box;
min-height: 100vh;
display: grid;
place-items: center;
margin: 0;
background: #ff4d1f;
font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
padding: clamp(8px, 4vw, 24px);
}
.ahf {
width: 100%;
max-width: 300px;
display: grid;
gap: 12px;
justify-items: center;
}
.ahf__btn {
border: 0;
border-radius: 12px;
padding: 8px 16px;
background: #17141a;
color: #fff7e6;
font: 700 13px/1 -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
cursor: pointer;
transition: transform 140ms ease-out;
}
.ahf__btn:active {
transform: scale(0.96);
}
.ahf__list {
width: 100%;
list-style: none;
margin: 0;
padding: 0;
display: grid;
gap: 8px;
}
.ahf__row {
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px 12px;
border-radius: 8px;
background: #fff7e6;
font: 600 12px/1 -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
animation: ahf-in 220ms ease-out backwards;
}
@keyframes ahf-in {
from {
transform: translateY(-8px);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}
.ahf__time {
color: rgba(23, 20, 26, 0.6);
}
.ahf__result {
color: #17141a;
}
.ahf__row--fail .ahf__result {
color: #c2361a;
}
.ahf__row--ok .ahf__result {
color: #0a4fe8;
}
@media (max-width: 340px) {
.ahf {
max-width: 220px;
}
.ahf__row {
font-size: 11px;
padding: 8px 8px;
}
}
@media (prefers-reduced-motion: reduce) {
.ahf__btn {
transition: none;
}
.ahf__row {
animation: none;
}
}(function () {
var root = document.getElementById('ahf');
var btn = document.getElementById('ahfBtn');
var list = document.getElementById('ahfList');
// 상수: 화면에 보이는 최대 기록 수 · 기록 하나마다 낮아지는 투명도 폭 · 최소 투명도
var MAX_ENTRIES = 5;
var OPACITY_STEP = 0.18;
var MIN_OPACITY = 0.16;
var SEQ = ['실패', '실패', '성공', '실패', '실패', '실패', '성공', '실패'];
var seqIdx = 0;
var entries = []; // 최신이 index 0
function fmtTime(n) {
var m = String(10 + n % 50).padStart(2, '0');
return '10:' + m;
}
// 계산 겹: i번째(0=최신) 항목의 불투명도 = max(최소, 1 − i×STEP)
function render() {
list.innerHTML = '';
for (var i = 0; i < entries.length; i++) {
var e = entries[i];
var op = Math.max(MIN_OPACITY, 1 - i * OPACITY_STEP);
var li = document.createElement('li');
li.className = 'ahf__row' + (e.result === '실패' ? ' ahf__row--fail' : ' ahf__row--ok');
li.style.opacity = op.toFixed(2);
li.innerHTML = '<span class="ahf__time">' + e.time + '</span>' +
'<span class="ahf__result">' + e.result + '</span>';
list.appendChild(li);
}
}
function addEntry() {
var result = SEQ[seqIdx % SEQ.length];
seqIdx += 1;
entries.unshift({ result: result, time: fmtTime(seqIdx) });
if (entries.length > MAX_ENTRIES) entries.length = MAX_ENTRIES;
render();
}
btn.addEventListener('click', function () {
root.classList.remove('is-demo');
stopAutoplay();
addEntry();
});
render();
var autoTimer = null;
function stopAutoplay() { if (autoTimer) { clearInterval(autoTimer); autoTimer = null; } }
var reduce = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
if (!reduce) { autoTimer = setInterval(addEntry, 340); }
})();import { useEffect, useRef } from "react";
import styles from "./AuthAttemptHistoryListFade.module.scss";
type Box<T> = { current: T };
type Entry = { result: string; time: string };
export default function AuthAttemptHistoryListFade() {
const rootRef = useRef(null) as unknown as Box<HTMLDivElement | null>;
useEffect(() => {
const root = rootRef.current;
if (!root) return;
const btn = root.querySelector(`.${styles.btn}`) as HTMLButtonElement | null;
const list = root.querySelector(`.${styles.list}`) as HTMLElement | null;
if (!btn || !list) return;
// 상수: 화면에 보이는 최대 기록 수 · 기록 하나마다 낮아지는 투명도 폭 · 최소 투명도
const MAX_ENTRIES = 5;
const OPACITY_STEP = 0.18;
const MIN_OPACITY = 0.16;
const SEQ = ["실패", "실패", "성공", "실패", "실패", "실패", "성공", "실패"];
let seqIdx = 0;
let entries: Entry[] = [];
function fmtTime(n: number) {
const m = String(10 + (n % 50)).padStart(2, "0");
return "10:" + m;
}
// 계산 겹: i번째(0=최신) 항목의 불투명도 = max(최소, 1 − i×STEP)
function render() {
list!.innerHTML = "";
for (let i = 0; i < entries.length; i++) {
const e = entries[i];
const op = Math.max(MIN_OPACITY, 1 - i * OPACITY_STEP);
const li = document.createElement("li");
li.className = styles.row + " " + (e.result === "실패" ? styles["row--fail"] : styles["row--ok"]);
li.style.opacity = op.toFixed(2);
li.innerHTML =
'<span class="' + styles.time + '">' + e.time + "</span>" +
'<span class="' + styles.result + '">' + e.result + "</span>";
list!.appendChild(li);
}
}
function addEntry() {
const result = SEQ[seqIdx % SEQ.length];
seqIdx += 1;
entries.unshift({ result, time: fmtTime(seqIdx) });
if (entries.length > MAX_ENTRIES) entries.length = MAX_ENTRIES;
render();
}
function onClick() {
root!.classList.remove(styles["is-demo"]);
stopAutoplay();
addEntry();
}
btn.addEventListener("click", onClick);
render();
let autoTimer: number | null = null;
function stopAutoplay() { if (autoTimer !== null) { window.clearInterval(autoTimer); autoTimer = null; } }
const reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
if (!reduce) { autoTimer = window.setInterval(addEntry, 340); }
return () => {
stopAutoplay();
btn.removeEventListener("click", onClick);
};
}, []);
return (
<div ref={rootRef} className={`${styles.stage} ${styles.ahf} ${styles["is-demo"]}`}>
<button className={styles.btn} type="button">로그인 시도 추가</button>
<ul className={styles.list} />
</div>
);
}07 시도 기록 흐림 목록 — 새 시도가 쌓일 때마다 오래된 기록일수록 투명도 값이 낮아지는 방식 — 측정 누적면적 39.983% · 움직인 프레임 22/23GODRICH 원작 · zip 에 SCSS·React 포함 · 로그인 실패 횟수 제한 9종 — 값이 계산으로 좁혀지는 잠금 아홉 가지
이 데모가 속한 글
로그인 실패 횟수 제한 9종 — 값이 계산으로 좁혀지는 잠금 아홉 가지로그인 실패 횟수 제한은 몇 번 틀리면 값이 어떻게 줄고 늘어나는지를 계산으로 보여주는 잠금 인터랙션을 말하는데, 아홉 개 중 하나는 로그인이 틀릴 때마다 남은 시도 횟수 값이 하나씩 줄어들고, 하나는 실패가 쌓일수 이 글의 데모 전부 보기


