양방향 와이프

Barn Doors

화면이 가운데서 양쪽으로 갈라져 문짝처럼 바깥으로 열립니다.

다른 이름: BarnDoorsbarn door transition

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

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

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

export default function ShaderEffect() {
  return (
    <Shader style={{ width: '100%', height: 320 }} disableTelemetry>
      <ImageTexture
        objectFit="cover"
        url="/samples/still.jpg" />
      <BarnDoors
        progress={{
          type: "auto-animate",
          mode: "ping-pong",
          outputMin: 0,
          outputMax: 1,
          speed: 0.5
        }}>
        <ImageTexture
          objectFit="cover"
          url="/samples/photo.jpg" />
      </BarnDoors>
    </Shader>
  )
}
Vue
<!-- WebGPU 를 지원하는 브라우저에서만 그립니다. -->
<!-- /samples/… 는 이 사이트의 샘플 파일입니다. 내 프로젝트의 이미지·영상 경로로 바꾸세요. -->
<script setup lang="ts">
import { Shader, BarnDoors, ImageTexture } from 'shaders/vue'
</script>

<template>
  <Shader style="width: 100%; height: 320px" :disable-telemetry="true">
    <ImageTexture
      object-fit="cover"
      url="/samples/still.jpg"/>
    <BarnDoors
      :progress="{
        type: 'auto-animate',
        mode: 'ping-pong',
        outputMin: 0,
        outputMax: 1,
        speed: 0.5
      }">
      <ImageTexture
        object-fit="cover"
        url="/samples/photo.jpg"/>
    </BarnDoors>
  </Shader>
</template>
Svelte
<!-- WebGPU 를 지원하는 브라우저에서만 그립니다. -->
<!-- /samples/… 는 이 사이트의 샘플 파일입니다. 내 프로젝트의 이미지·영상 경로로 바꾸세요. -->
<script>
  import { Shader, BarnDoors, ImageTexture } from 'shaders/svelte'
</script>

<Shader style="width: 100%; height: 320px" disableTelemetry>
  <ImageTexture
    objectFit="cover"
    url="/samples/still.jpg" />
  <BarnDoors
    progress={{
      type: "auto-animate",
      mode: "ping-pong",
      outputMin: 0,
      outputMax: 1,
      speed: 0.5
    }}>
    <ImageTexture
      objectFit="cover"
      url="/samples/photo.jpg" />
  </BarnDoors>
</Shader>
Solid
// WebGPU 를 지원하는 브라우저에서만 그립니다.
// /samples/… 는 이 사이트의 샘플 파일입니다. 내 프로젝트의 이미지·영상 경로로 바꾸세요.
import { Shader, BarnDoors, ImageTexture } from 'shaders/solid'

export default function ShaderEffect() {
  return (
    <Shader style={{ width: '100%', height: '320px' }} disableTelemetry>
      <ImageTexture
        objectFit="cover"
        url="/samples/still.jpg" />
      <BarnDoors
        progress={{
          type: "auto-animate",
          mode: "ping-pong",
          outputMin: 0,
          outputMax: 1,
          speed: 0.5
        }}>
        <ImageTexture
          objectFit="cover"
          url="/samples/photo.jpg" />
      </BarnDoors>
    </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/still.jpg',
      },
    },
    {
      type: 'BarnDoors',
      props: {
        progress: {
          type: 'auto-animate',
          mode: 'ping-pong',
          outputMin: 0,
          outputMax: 1,
          speed: 0.5
        },
      },
      children: [
        {
          type: 'ImageTexture',
          props: {
            objectFit: 'cover',
            url: '/samples/photo.jpg',
          },
        },
      ],
    }
  ]
}, { disableTelemetry: true })

속성(props) · BarnDoors

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

이름값기본값범위·선택지설명(원문)
progressProgress데모에서 자동으로 오가는 값 — 움직이면 그 값에 고정됩니다0.50 – 1 (step 0.01)How far the doors have opened (0 = fully visible, 1 = fully wiped away)
angleAngle00 – 360 (step 1)Direction the doors open in degrees (0 = apart horizontally)
featherFeather0.10 – 1 (step 0.01)Softness of the wipe edges
invertInvertfalse—Close in from both edges instead of opening from the center

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

가운데 경계에서 두 패널이 좌우로 열리는 무대 커튼처럼 보입니다. 중앙에서 바깥으로 시선이 퍼집니다.

`progress`는 기본 0.5, 범위 0–1이며 열림 진행 정도를 정합니다. `angle`은 기본 0도, 범위 0–360도로 문짝이 벌어지는 방향을 바꿉니다. `feather`는 기본 0.1, 범위 0–1로 경계를 부드럽게 하고 `invert`는 기본 false로 양쪽 가장자리에서 안으로 닫히게 합니다.

입력 화면 위에 놓고 두 장면 전환에서는 새 장면을 아래 레이어에 둔 뒤 progress를 움직이세요. 가운데에 얼굴이나 로고가 있으면 경계가 중요한 부분을 가를 수 있으니 중심 위치와 타이밍을 살피세요.

언제 쓰나

두 화면을 중앙에서 갈라 소개하거나, 무대 커튼 같은 인트로, 좌우로 확장되는 장면 전환에 좋습니다. 중앙의 얼굴·로고를 온전히 유지해야 한다면 피하세요.

페이지로 열기 ↗