인벤토리 그리드

Inventory Grid

아이템을 균일한 칸에 담아 격자로 늘어놓고, 새로 획득한 칸은 배지나 반짝임으로 눈에 띄게 하는 소지품 화면.

다른 이름: 아이템 창Item grid가방
···
html
<div class="igrid" id="igrid"></div>
css
.igrid{display:grid;grid-template-columns:repeat(6,1fr);gap:clamp(4px,1.6vmin,8px);width:min(92%,420px)}
.islot{position:relative;aspect-ratio:1;border-radius:7px;background:var(--surface);border:1px solid var(--line)}
.islot.filled{border-color:var(--tier,var(--line))}
.iicon{position:absolute;inset:20%;border-radius:4px;background:var(--tier,var(--muted))}
.icount{position:absolute;right:3px;bottom:2px;font:800 clamp(6px,1.8vmin,9px) monospace;color:var(--fg)}
.ibadge{position:absolute;top:-4px;right:-4px;width:12px;height:12px;border-radius:50%;background:var(--accent-2);
  display:grid;place-items:center;font:800 7px monospace;color:#fff;opacity:0;transform:scale(0.4);transition:all .3s cubic-bezier(.3,1.6,.4,1)}
.ibadge.show{opacity:1;transform:scale(1)}
js
const igrid=document.getElementById('igrid');
const tiers=['var(--muted)','var(--accent-3)','var(--accent)','#a259ff'];
const slots=[];
for(let i=0;i<24;i++){
  const el=document.createElement('div');
  el.className='islot';
  igrid.appendChild(el);
  slots.push(el);
}
function fillSlot(i, count){
  const el=slots[i];
  const tier=tiers[Math.floor(Math.random()*tiers.length)];
  el.classList.add('filled');
  el.style.setProperty('--tier', tier);
  el.innerHTML='<div class="iicon"></div>'+(count>1?'<div class="icount">x'+count+'</div>':'')+'<div class="ibadge">N</div>';
  requestAnimationFrame(function(){ el.querySelector('.ibadge').classList.add('show'); });
  setTimeout(function(){
    const b=el.querySelector('.ibadge');
    if(b) b.classList.remove('show');
  }, 1600);
}
for(let s=0;s<14;s++){ fillSlot(s, Math.random()<0.4 ? Math.ceil(Math.random()*9) : 1); }
document.querySelectorAll('.ibadge').forEach(function(b){ b.classList.remove('show'); });
let filled=14;
function tick(){
  if(filled>=slots.length){ filled=14; setTimeout(tick, 1400); return; }
  fillSlot(filled, Math.random()<0.4 ? Math.ceil(Math.random()*9) : 1);
  filled++;
  setTimeout(tick, 420);
}
setTimeout(tick, 500);

인벤토리 그리드는 정사각형 슬롯을 균일한 간격으로 늘어놓은 형태가 표준이다. 슬롯 크기와 간격이 일정해야 아이템 개수가 늘어도 눈이 스캔하는 리듬이 깨지지 않는다. 빈 슬롯은 테두리만 남겨 "여기 더 넣을 수 있다"는 여백을 분명히 보여준다.

새로 얻은 아이템에는 보통 작은 점이나 "N" 배지, 혹은 한 번 반짝이는 셰이더 스윕을 준다 — 플레이어가 굳이 전체를 훑지 않아도 뭐가 바뀌었는지 알 수 있게 하기 위해서다. 겹쳐 쌓이는 아이템(포션 3개 등)은 우측 하단에 작은 숫자로 수량을 표시하는 것이 관례다.

등급(희귀도) 색이 있는 게임이면 슬롯 테두리 색으로 이어서 인벤토리 안에서도 값어치를 훑어볼 수 있게 한다. 슬롯이 꽉 찼을 때의 처리(자동 정렬, 판매 유도, 확장 구매 등)는 UI보다 앞서 설계돼야 그리드가 그 규칙을 그대로 반영할 수 있다.

언제 쓰나

수집 가능한 아이템·재료·카드가 여러 개 쌓이는 소지품·창고 화면 전반.