정다각형

Polygon

변의 수와 꼭짓점의 둥글기를 조절해 삼각형부터 원에 가까운 다각형까지 만듭니다.

다른 이름: PolygonRegular polygon

WebGPU 를 지원하는 브라우저에서 움직입니다

이 기기에서는 데모를 그리지 못해 정지 화면을 보여 줍니다

React
// WebGPU 를 지원하는 브라우저에서만 그립니다.
import { Shader, Polygon } from 'shaders/react'

export default function ShaderEffect() {
  return (
    <Shader style={{ width: '100%', height: 320 }} disableTelemetry>
      <Polygon />
    </Shader>
  )
}
Vue
<!-- WebGPU 를 지원하는 브라우저에서만 그립니다. -->
<script setup lang="ts">
import { Shader, Polygon } from 'shaders/vue'
</script>

<template>
  <Shader style="width: 100%; height: 320px" :disable-telemetry="true">
    <Polygon/>
  </Shader>
</template>
Svelte
<!-- WebGPU 를 지원하는 브라우저에서만 그립니다. -->
<script>
  import { Shader, Polygon } from 'shaders/svelte'
</script>

<Shader style="width: 100%; height: 320px" disableTelemetry>
  <Polygon />
</Shader>
Solid
// WebGPU 를 지원하는 브라우저에서만 그립니다.
import { Shader, Polygon } from 'shaders/solid'

export default function ShaderEffect() {
  return (
    <Shader style={{ width: '100%', height: '320px' }} disableTelemetry>
      <Polygon />
    </Shader>
  )
}
JavaScript
// WebGPU 를 지원하는 브라우저에서만 그립니다.
// <canvas id="canvas" style="width:100%;height:320px"></canvas> 가 페이지에 있어야 한다
import { createShader } from 'shaders/js'

const shader = await createShader(document.getElementById("canvas"), {
  components: [
    {
      type: 'Polygon',
    }
  ]
}, { disableTelemetry: true })

속성(props) · Polygon

값을 바꾸면 위 데모와 코드 탭에 바로 반영됩니다. 설명은 라이브러리 레지스트리의 영어 원문(MIT)입니다.

이름값기본값범위·선택지설명(원문)
originOrigin코드에서 지정center—Reference edge the center position is measured from (center default). Lets you pin the shape relative to a corner or the canvas centre.
colorColor#ffffff—Fill color of the polygon
centerCenter
x0.5y0.5
{"x":0.5,"y":0.5}x, y: 0 – 1Center position of the polygon
radiusRadius0.40 – 1 (step 0.01)Inradius — distance from the center to the middle of each side, in UV space (the vertices sit a little farther out)
sidesSides63 – 12 (step 1)Number of sides (3 = triangle, 4 = square, 6 = hexagon, etc.)
roundingRounding00 – 1 (step 0.01)Corner rounding — 0 is sharp vertices, 1 morphs into a circle
rotationRotation00 – 360 (step 1)Rotation in degrees
softnessSoftness00 – 0.1 (step 0.001)Edge softness for antialiasing
strokeThicknessStroke Thickness00 – 0.2 (step 0.005)Stroke thickness. Zero means no stroke.
strokeColorStroke Color#000000—Color of the stroke outline
strokePositionStroke Positioncenteroutside · center · insidePosition of the stroke relative to the shape edge
colorSpaceColor Blendinglinearlinear · oklch · oklab · hsl · hsv · lchColor space for blending fill and stroke colors

모든 컴포넌트 공통: blendMode · opacity · visible · maskSource/maskType · boundingBox · id

정다각형은 같은 길이의 변이 중심을 둘러싸는 도형입니다. 변의 수를 바꾸면 삼각형·사각형·육각형처럼 실루엣이 달라집니다.

`sides`는 변의 수로 3–12 범위입니다. `radius`는 중심에서 각 변의 가운데까지 거리이며 범위는 0–1입니다. `rounding`을 0에서 1로 높이면 각진 꼭짓점이 둥글어져 원에 가까워지고, `rotation`은 0–360도 사이에서 방향을 바꿉니다.

`rounding`을 크게 하면 다각형의 각이 점점 사라지므로 변의 수가 중요한 아이콘에서는 낮게 유지하세요. `Star`나 `Flower`와 함께 두면 같은 중심에서 각진 모양과 방사형 모양을 비교하기 쉽습니다.

언제 쓰나

기하학 아이콘, 배지, 반복 패턴의 기본 실루엣에 좋습니다. 특정 변 수의 정다각형을 만들거나 모서리를 부드럽게 바꿀 수 있습니다. 유기적인 비대칭 윤곽이 필요하면 피하세요.

페이지로 열기 ↗