CSS Graphics Geometry
Guide
Reference
GitHub
Guide
Reference
GitHub
  • Part 0. Math foundations

    • 좌표계와 CSS pixel
    • 점, 벡터, 거리와 기본 용어
    • 각도, 라디안, atan2
  • Part 1. Transform linear algebra

    • translate, scale, rotate
    • CSS matrix(a,b,c,d,e,f)
    • 변환 순서와 transform-origin
    • local, world, screen 좌표계
    • inverse matrix와 포인터 입력
    • 좌표와 transform 디버깅
  • Part 2. Infinite canvas math and architecture

    • viewport와 camera 모델
    • cursor anchored zoom
    • ruler와 tick 계산
    • 주기 함수와 grid step
    • content, overlay, controls layer
    • scene graph와 nested transform
  • Part 3. Editor tool math

    • Pointer Events와 드래그
    • DOMRect와 getBoundingClientRect
    • hit testing과 bounding box
    • selection rectangle과 marquee
    • selection bounds와 handles
    • resize와 rotation handle
    • snapping과 smart guides
    • group, frame, clipping
  • Part 4. CSS graphics properties as math

    • CSS box로 도형 만들기
    • clip-path, radius, shadow
    • 선형보간과 linear-gradient
    • 거리 함수와 radial/conic-gradient
    • stacking context와 합성
    • layout, paint, composite
  • Part 5. Editor state and persistence

    • 레이어 모델과 z-index
    • 이동, 복제, 삭제, 잠금
    • undo/redo command model
    • JSON export/import
  • Part 6. SVG overlay and vector editing

    • SVG viewBox와 좌표계
    • getScreenCTM과 inverse
    • SVG pointer-events와 stroke hit testing
    • cubic bezier path editing
    • mask, clipPath, marker
  • Part 7. Figma to CSS translation

    • Figma node와 CSS DOM 모델
    • Frame constraints와 Auto Layout
    • Fills, strokes, effects를 CSS로
    • Vector와 text 변환
    • gradient 밖의 CSS 수학
    • Figma gradient를 CSS gradient로 변환하기
    • 수학이 필요한 Figma to CSS 속성들
    • Figma VectorNetwork 정리
  • Appendix A. Canvas renderer transition

    • Canvas로 넘어가는 기준
  • Appendix B. Motion and timing

    • 모션 수학과 timing 함수
    • Keyframe timeline 엔진
    • Motion path 수학
    • Bezier curve 길이 구하기

Vector와 text 변환

이번에는 Figma vector와 text를 CSS로 옮기는 문제입니다.

rectangle은 div로 옮기기 쉽습니다. 그런데 vector path와 text는 조금 더 예민합니다. 둘 다 “대충 보이면 됨”으로 넘기면, 실제 제품 화면에서 금방 티가 납니다.

vector는 SVG가 자연스럽다

Figma vector는 path, boolean operation, stroke, fill, winding rule 같은 정보를 가질 수 있습니다. CSS box만으로 표현하기 어려운 경우가 많습니다.

simple icon -> inline SVG
complex illustration -> SVG asset or image asset
editable vector -> SVG path model
decorative mask -> clip-path / mask / SVG

CSS clip-path: polygon(...)으로 간단한 도형은 만들 수 있습니다. 하지만 bezier curve, stroke join, marker, fill rule이 중요하면 SVG가 훨씬 솔직한 표현입니다.

Figma vector and text to CSS SVG diagramText nodefont, line-heightvector -> SVG path or asset, text -> CSS font metrics with careful line-height and letter-spacing
Figma vector와 text는 CSS box만으로는 부족할 때가 많습니다. path, stroke, text metrics는 SVG나 export asset과 함께 판단해야 합니다.

text는 metric이 문제다

Figma text를 CSS로 옮길 때는 font family, weight, size만 보면 부족합니다.

fontFamily
fontWeight
fontSize
lineHeight
letterSpacing
paragraphSpacing
textAlign
textBox resize mode

특히 line-height와 letter-spacing은 브라우저와 Figma의 렌더링 차이가 보일 수 있습니다. 같은 숫자를 넣어도 폰트 파일, fallback, antialiasing, line box 계산 때문에 픽셀이 조금 다를 수 있습니다.

그래서 text export에서는 “정확한 픽셀 고정”과 “웹에서 자연스러운 텍스트” 중 무엇이 중요한지 결정해야 합니다. 로고나 복잡한 타이포그래피는 SVG/이미지로 내보내는 편이 안정적일 수 있고, 실제 문단 텍스트는 CSS text로 남겨야 접근성과 반응형이 살아납니다.

데모에서 볼 것

데모에서는 vector path와 text box를 나란히 두고, CSS box, SVG path, CSS text가 각각 어떤 정보를 책임지는지 봅니다.

오늘의 핵심은 이겁니다. 모든 Figma node를 div로 바꾸려고 하지 마세요. div는 박스에 강하고, SVG는 벡터에 강하고, CSS text는 실제 텍스트에 강합니다. 도구마다 특기가 있습니다.

Edit this page
최근 수정: 26. 5. 14. PM 5:45
Contributors: easylogic
Prev
Fills, strokes, effects를 CSS로
Next
gradient 밖의 CSS 수학