코너 핀

Corner Pin

입력 이미지의 네 모서리를 각각 옮겨 사다리꼴이나 비스듬한 화면에 맞춥니다.

다른 이름: CornerPinFour-corner warp

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

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

React
// WebGPU 를 지원하는 브라우저에서만 그립니다.
// /samples/… 는 이 사이트의 샘플 파일입니다. 내 프로젝트의 이미지·영상 경로로 바꾸세요.
import { Shader, CornerPin, ImageTexture } from 'shaders/react'

export default function ShaderEffect() {
  return (
    <Shader style={{ width: '100%', height: 320 }} disableTelemetry>
      <ImageTexture
        objectFit="cover"
        url="/samples/poster.jpg" />
      <CornerPin
        bottomLeft={{
          x: 0.03,
          y: 0.92
        }}
        bottomRight={{
          x: 0.96,
          y: 0.86
        }}
        topLeft={{
          x: 0.08,
          y: 0.14
        }}
        topRight={{
          x: 0.88,
          y: 0.04
        }} />
    </Shader>
  )
}
Vue
<!-- WebGPU 를 지원하는 브라우저에서만 그립니다. -->
<!-- /samples/… 는 이 사이트의 샘플 파일입니다. 내 프로젝트의 이미지·영상 경로로 바꾸세요. -->
<script setup lang="ts">
import { Shader, CornerPin, ImageTexture } from 'shaders/vue'
</script>

<template>
  <Shader style="width: 100%; height: 320px" :disable-telemetry="true">
    <ImageTexture
      object-fit="cover"
      url="/samples/poster.jpg"/>
    <CornerPin
      :bottom-left="{
        x: 0.03,
        y: 0.92
      }"
      :bottom-right="{
        x: 0.96,
        y: 0.86
      }"
      :top-left="{
        x: 0.08,
        y: 0.14
      }"
      :top-right="{
        x: 0.88,
        y: 0.04
      }"/>
  </Shader>
</template>
Svelte
<!-- WebGPU 를 지원하는 브라우저에서만 그립니다. -->
<!-- /samples/… 는 이 사이트의 샘플 파일입니다. 내 프로젝트의 이미지·영상 경로로 바꾸세요. -->
<script>
  import { Shader, CornerPin, ImageTexture } from 'shaders/svelte'
</script>

<Shader style="width: 100%; height: 320px" disableTelemetry>
  <ImageTexture
    objectFit="cover"
    url="/samples/poster.jpg" />
  <CornerPin
    bottomLeft={{
      x: 0.03,
      y: 0.92
    }}
    bottomRight={{
      x: 0.96,
      y: 0.86
    }}
    topLeft={{
      x: 0.08,
      y: 0.14
    }}
    topRight={{
      x: 0.88,
      y: 0.04
    }} />
</Shader>
Solid
// WebGPU 를 지원하는 브라우저에서만 그립니다.
// /samples/… 는 이 사이트의 샘플 파일입니다. 내 프로젝트의 이미지·영상 경로로 바꾸세요.
import { Shader, CornerPin, ImageTexture } from 'shaders/solid'

export default function ShaderEffect() {
  return (
    <Shader style={{ width: '100%', height: '320px' }} disableTelemetry>
      <ImageTexture
        objectFit="cover"
        url="/samples/poster.jpg" />
      <CornerPin
        bottomLeft={{
          x: 0.03,
          y: 0.92
        }}
        bottomRight={{
          x: 0.96,
          y: 0.86
        }}
        topLeft={{
          x: 0.08,
          y: 0.14
        }}
        topRight={{
          x: 0.88,
          y: 0.04
        }} />
    </Shader>
  )
}
JavaScript
// WebGPU 를 지원하는 브라우저에서만 그립니다.
// /samples/… 는 이 사이트의 샘플 파일입니다. 내 프로젝트의 이미지·영상 경로로 바꾸세요.
// <canvas id="canvas" style="width:100%;height:320px"></canvas> 가 페이지에 있어야 한다
import { createShader } from 'shaders/js'

const shader = await createShader(document.getElementById("canvas"), {
  components: [
    {
      type: 'ImageTexture',
      props: {
        objectFit: 'cover',
        url: '/samples/poster.jpg',
      },
    },
    {
      type: 'CornerPin',
      props: {
        bottomLeft: {
          x: 0.03,
          y: 0.92
        },
        bottomRight: {
          x: 0.96,
          y: 0.86
        },
        topLeft: {
          x: 0.08,
          y: 0.14
        },
        topRight: {
          x: 0.88,
          y: 0.04
        },
      },
    }
  ]
}, { disableTelemetry: true })

속성(props) · CornerPin

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

이름값기본값범위·선택지설명(원문)
topLeftTop Left
x0.08y0.14
{"x":0,"y":0}x, y: 0 – 1Position of the top-left corner
topRightTop Right
x0.88y0.04
{"x":1,"y":0}x, y: 0 – 1Position of the top-right corner
bottomLeftBottom Left
x0.03y0.92
{"x":0,"y":1}x, y: 0 – 1Position of the bottom-left corner
bottomRightBottom Right
x0.96y0.86
{"x":1,"y":1}x, y: 0 – 1Position of the bottom-right corner
amountAmount10 – 1 (step 0.01)Blends the warp in and out — 0 returns the content to its original rectangle, 1 fully pins the corners
edgesEdgestransparentstretch · transparent · mirror · wrapHow to handle areas outside the pinned quad

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

평평한 화면을 벽에 비스듬히 투사한 것처럼, 네 모서리를 따로 움직여 입력을 사다리꼴 모양으로 맞춥니다.

`topLeft`, `topRight`, `bottomLeft`, `bottomRight`가 각 모서리의 위치를 정하고 `amount`는 원본 사각형과 완성된 변형 사이를 섞습니다.

입력 이미지 레이어 위에 놓으세요. `Perspective`의 전체 기울기와 함께 쓰면 목업을 세밀하게 맞추기 좋습니다. 모서리를 크게 당기면 빈 가장자리가 생기거나 글자 비율이 달라질 수 있으니 `edges`를 조절하고 변형 뒤 가독성을 확인하세요.

언제 쓰나

비스듬한 기기 화면에 콘텐츠를 맞추거나 포스터·영상의 원근 목업을 만들 때 유용합니다. 글자 간격과 직사각형 비율을 그대로 유지해야 하는 화면에는 피하세요.

페이지로 열기 ↗