사다리꼴

Trapezoid

위쪽과 아래쪽 폭을 따로 정해 사다리꼴의 실루엣을 만듭니다.

다른 이름: TrapezoidTrapezium

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

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

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

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

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

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

export default function ShaderEffect() {
  return (
    <Shader style={{ width: '100%', height: '320px' }} disableTelemetry>
      <Trapezoid />
    </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: 'Trapezoid',
    }
  ]
}, { disableTelemetry: true })

속성(props) · Trapezoid

값을 바꾸면 위 데모와 코드 탭에 바로 반영됩니다. 설명은 라이브러리 레지스트리의 영어 원문(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 trapezoid
centerCenter
x0.5y0.5
{"x":0.5,"y":0.5}x, y: 0 – 1Center position of the trapezoid
bottomWidthBottom Width0.350.01 – 1 (step 0.01)Half-width of the bottom edge
topWidthTop Width0.20.01 – 1 (step 0.01)Half-width of the top edge
heightHeight0.250.01 – 1 (step 0.01)Half-height of the trapezoid
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

사다리꼴은 위아래 변의 길이가 다른 사각형입니다. 아래가 넓은 받침대나 원근감 있는 패널처럼 안정감과 방향을 함께 표현할 수 있습니다.

`topWidth`와 `bottomWidth`는 위·아래 변의 반쪽 폭이며 각각 0.01–1 범위입니다. `height`는 반쪽 높이로 0.01–1 범위이고, `rotation`은 0–360도 사이에서 도형을 돌립니다.

위쪽이 더 넓은 형태도 만들 수 있으므로 특정 방향이 필요하면 두 폭을 의도적으로 정하세요. `Parallelogram`과 나란히 두면 기울어진 변과 폭이 다른 변의 차이를 보여 줄 수 있고, 텍스트를 얹을 때는 좁은 쪽의 여백을 확인하세요.

언제 쓰나

받침대·배너·원근감 있는 패널처럼 위아래 폭 차이가 필요한 곳에 좋습니다. 표식이나 도식의 방향을 시각적으로 강조할 수도 있습니다. 평행한 네 변이나 모서리 둥글기가 필요하면 피하세요.

페이지로 열기 ↗