Scratches

스크래치

Fine hairline marks resemble scratches on worn film or a surface.

Also known as: Scratches필름 스크래치

Moves in browsers that support WebGPU

This device could not render the demo — showing a still

React
// Renders only in browsers with WebGPU.
import { Shader, Scratches } from 'shaders/react'

export default function ShaderEffect() {
  return (
    <Shader style={{ width: '100%', height: 320 }} disableTelemetry>
      <Scratches />
    </Shader>
  )
}
Vue
<!-- Renders only in browsers with WebGPU. -->
<script setup lang="ts">
import { Shader, Scratches } from 'shaders/vue'
</script>

<template>
  <Shader style="width: 100%; height: 320px" :disable-telemetry="true">
    <Scratches/>
  </Shader>
</template>
Svelte
<!-- Renders only in browsers with WebGPU. -->
<script>
  import { Shader, Scratches } from 'shaders/svelte'
</script>

<Shader style="width: 100%; height: 320px" disableTelemetry>
  <Scratches />
</Shader>
Solid
// Renders only in browsers with WebGPU.
import { Shader, Scratches } from 'shaders/solid'

export default function ShaderEffect() {
  return (
    <Shader style={{ width: '100%', height: '320px' }} disableTelemetry>
      <Scratches />
    </Shader>
  )
}
JavaScript
// Renders only in browsers with WebGPU.
// 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: 'Scratches',
    }
  ]
}, { disableTelemetry: true })

Props · Scratches

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

NameValueDefaultRange / optionsDescription
colorAColor A#ffffff—First color
colorBColor B#000000—Second color
scaleScale2-2 – 5 (step 0.1)Pattern scale (higher = more, finer scratches)
thicknessThickness10.2 – 5 (step 0.01)Thickness of the scratches (higher = bolder streaks)
seedSeed00 – 100 (step 1)Random seed for pattern variation
speedSpeed10 – 5 (step 0.1)Animation speed

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

It resembles fine marks left on old film or a worn surface. The scratches add rough traces to an even field and suggest an aged medium.

Raise `scale` for more, finer scratches; raise `thickness` to make each mark bolder. Change `seed` for a different random arrangement, and use `speed` to control movement. The two colors create both light and dark scratches.

This generator fills the canvas without an input layer. `speed` defaults to 1, so the pattern moves. Marks that are too bold or high-contrast can cover details in photos and text; keep them restrained when you only want to add texture.

When to use

Use it for vintage-film backgrounds, worn-poster texture, or graphics that need a used surface. Avoid strong scratches that hide photo details or small text.

Open as page ↗