Repeater

레이어 반복

One input repeats in a grid, circle, or line, with optional variation between copies.

Also known as: RepeaterInstance repeater

Moves in browsers that support WebGPU

This device could not render the demo — showing a still

React
// Renders only in browsers with WebGPU.
// /samples/… are this site’s sample files — point them at your own image or video.
import { Shader, ImageTexture, Repeater } from 'shaders/react'

export default function ShaderEffect() {
  return (
    <Shader style={{ width: '100%', height: 320 }} disableTelemetry>
      <ImageTexture
        objectFit="cover"
        url="/samples/photo.jpg" />
      <Repeater />
    </Shader>
  )
}
Vue
<!-- Renders only in browsers with WebGPU. -->
<!-- /samples/… are this site’s sample files — point them at your own image or video. -->
<script setup lang="ts">
import { Shader, ImageTexture, Repeater } from 'shaders/vue'
</script>

<template>
  <Shader style="width: 100%; height: 320px" :disable-telemetry="true">
    <ImageTexture
      object-fit="cover"
      url="/samples/photo.jpg"/>
    <Repeater/>
  </Shader>
</template>
Svelte
<!-- Renders only in browsers with WebGPU. -->
<!-- /samples/… are this site’s sample files — point them at your own image or video. -->
<script>
  import { Shader, ImageTexture, Repeater } from 'shaders/svelte'
</script>

<Shader style="width: 100%; height: 320px" disableTelemetry>
  <ImageTexture
    objectFit="cover"
    url="/samples/photo.jpg" />
  <Repeater />
</Shader>
Solid
// Renders only in browsers with WebGPU.
// /samples/… are this site’s sample files — point them at your own image or video.
import { Shader, ImageTexture, Repeater } from 'shaders/solid'

export default function ShaderEffect() {
  return (
    <Shader style={{ width: '100%', height: '320px' }} disableTelemetry>
      <ImageTexture
        objectFit="cover"
        url="/samples/photo.jpg" />
      <Repeater />
    </Shader>
  )
}
JavaScript
// Renders only in browsers with WebGPU.
// /samples/… are this site’s sample files — point them at your own image or video.
// expects <canvas id="canvas" style="width:100%;height:320px"></canvas> on the page
import { createShader } from 'shaders/js'

const shader = await createShader(document.getElementById("canvas"), {
  components: [
    {
      type: 'ImageTexture',
      props: {
        objectFit: 'cover',
        url: '/samples/photo.jpg',
      },
    },
    {
      type: 'Repeater',
    }
  ]
}, { disableTelemetry: true })

Props · Repeater

Changes apply to the demo above and to the code tabs. Descriptions come from the library registry (MIT).

NameValueDefaultRange / optionsDescription
modeModegridgrid · radial · linearLayout used to place the repeated instances
cropLeftCrop Left00 – 0.49 (step 0.005)Crop inset from the left edge of the source element (fraction of its width)
cropRightCrop Right00 – 0.49 (step 0.005)Crop inset from the right edge of the source element (fraction of its width)
cropTopCrop Top00 – 0.49 (step 0.005)Crop inset from the top edge of the source element (fraction of its height)
cropBottomCrop Bottom00 – 0.49 (step 0.005)Crop inset from the bottom edge of the source element (fraction of its height)
columnsColumns31 – 12 (step 1)Number of grid columns
rowsRows31 – 12 (step 1)Number of grid rows
gapXGap X0.050 – 0.5 (step 0.005)Horizontal gap between grid cells
gapYGap Y0.050 – 0.5 (step 0.005)Vertical gap between grid cells
staggerStagger00 – 1 (step 0.01)Horizontal offset applied to every other row (brick layout)
flipFlipnonenone · alternate-flip-x · alternate-flip-y · bothMirror alternating columns/rows for seamless tiling patterns
countCount81 – 64 (step 1)Number of repeated instances
radiusRadius0.30 – 1 (step 0.005)Orbit radius of the radial layout
startAngleStart Angle00 – 360 (step 1)Angle of the first instance on the orbit
sweepSweep3600 – 360 (step 1)Angular span the instances are distributed across
faceCenterFace Centerfalse—Rotate each instance to face the orbit center
directionDirection00 – 360 (step 1)Direction of the linear layout in degrees (0 = rightward)
spacingSpacing0.20 – 1 (step 0.005)Distance between consecutive instances
instanceScaleScale10.5 – 2 (step 0.005)Progressive scale multiplier applied per instance (compounds with each copy)
instanceRotationRotation0-180 – 180 (step 1)Additional rotation in degrees applied per instance (accumulates with each copy)
instanceOpacityOpacity10 – 1 (step 0.005)Progressive opacity falloff applied per instance (compounds with each copy)
hueShiftHue Shift00 – 360 (step 1)Hue rotation in degrees added per instance
phasePhase00 – 1 (step 0.001)Seamless layout animation phase (0-1 wraps to the identical layout)
zOrderZ-Orderforwardforward · backwardStacking order of overlapping instances
jitterPositionPosition00 – 1 (step 0.005)Random per-instance position offset
jitterRotationRotation00 – 1 (step 0.005)Random per-instance rotation
jitterScaleScale00 – 1 (step 0.005)Random per-instance scale variation
jitterOpacityOpacity00 – 1 (step 0.005)Random per-instance opacity variation
seedSeed00 – 100 (step 1)Random seed for the jitter values

Every component also takes blendMode · opacity · visible · maskSource/maskType · boundingBox · id

Like stamping one sticker into a grid or circle, a single input is copied into a repeated layout.

Choose a grid, radial, or linear arrangement with `mode`. In grid mode, `columns` and `rows` set the number of cells; in radial and linear modes, `count` sets the number of copies. `spacing` changes the distance between copies in a linear layout.

Put the image or shape to repeat inside the Repeater. Available controls depend on the selected layout, and copies can also vary in scale, rotation, and opacity. Too many copies can merge into visual noise, so use simple shapes or patterns rather than tiny icons.

When to use

Use it for background patterns, icon arrays, and radial decoration. Avoid it when each copy must remain individually readable at high density.

Open as page ↗