Skip to documentation

Components

Pencil Logo

A two-pass pencil-sketch effect that draws an SVG logo with noisy graphite contours, tonal strokes, paper grain, and vignette.

  • pixi.js@^8.20.1

Preparing preview…

Installation

Choose your framework. The registry installs one component file and its PixiJS dependency.

Installation unavailable

This preview is not assigned to the free or paid catalog. Installation is unavailable.

The registry command writes the component to src/lib/components/ui/PencilLogo.svelte and installs its dependencies.

The registry command writes the component to src/components/ui/PencilLogo.tsx and installs its dependencies.

The registry command writes the component to src/components/ui/PencilLogo.vue and installs its dependencies.

The generated component builds its SVG distance field locally and renders the intermediate luminance pass on the GPU.

PixiJS provides the render texture pipeline for both WebGPU and WebGL.

Overview

Pencil Logo is a true two-pass shader. The first pass renders the SVG distance field as a grayscale subject; the second derives noisy luminance gradients and directional graphite texture from that image.

The paper covers the entire canvas. Procedural noise replaces the reference noise texture while preserving its distorted sampling, paper grain, tonal strokes, and vignette technique.

Basic usage

The shader fills its parent. Your layout decides whether that parent is a card, hero, or viewport.

Hero.svelte
<script lang="ts">
	import PencilLogo from '$lib/components/ui/PencilLogo.svelte';
</script>

<section class="relative h-128 overflow-hidden">
	<PencilLogo
		class="absolute inset-0"
		svgSource="/images/your-logo.svg"
		speed={0.8}
	/>

	<div class="relative z-10">Your content</div>
</section>
<script lang="ts">
	import PencilLogo from '$lib/components/ui/PencilLogo.svelte';
</script>

<section class="relative h-128 overflow-hidden">
	<PencilLogo
		class="absolute inset-0"
		svgSource="/images/your-logo.svg"
		speed={0.8}
	/>

	<div class="relative z-10">Your content</div>
</section>
import { PencilLogo } from '@/components/ui/PencilLogo';

export function Hero() {
	return (
		<section className="relative h-128 overflow-hidden">
			<PencilLogo
				className="absolute inset-0"
				svgSource="/images/your-logo.svg"
				speed={0.8}
			/>

			<div className="relative z-10">Your content</div>
		</section>
	);
}
import { PencilLogo } from '@/components/ui/PencilLogo';

export function Hero() {
	return (
		<section className="relative h-128 overflow-hidden">
			<PencilLogo
				className="absolute inset-0"
				svgSource="/images/your-logo.svg"
				speed={0.8}
			/>

			<div className="relative z-10">Your content</div>
		</section>
	);
}
<script setup lang="ts">
import PencilLogo from '@/components/ui/PencilLogo.vue';
</script>

<template>
	<section class="relative h-128 overflow-hidden">
		<PencilLogo
			class="absolute inset-0"
			svgSource="/images/your-logo.svg"
			:speed="0.8"
		/>

		<div class="relative z-10">Your content</div>
	</section>
</template>
<script setup lang="ts">
import PencilLogo from '@/components/ui/PencilLogo.vue';
</script>

<template>
	<section class="relative h-128 overflow-hidden">
		<PencilLogo
			class="absolute inset-0"
			svgSource="/images/your-logo.svg"
			:speed="0.8"
		/>

		<div class="relative z-10">Your content</div>
	</section>
</template>
  • The effect is intentionally monochrome by default. Paper and graphite colors can be tinted without changing the sketch response.
  • Subject tone changes the source-pass luminance and therefore the density of the pencil texture, not a separate overlay.
  • Grain motion defaults to zero for a stable drawing. Raise it only when an animated sketch is desired.

Component API

Types below match the selected Svelte component.

Property Type Default Range / values
class
string
svgSource
string Inline SVG, URL, or data URL
speed
number 0 0–2
scale
number 1 0.2–2
offsetX
number 0 -0.5–0.5
offsetY
number 0 -0.5–0.5
rotation
number 0 -180–180
paperColor
string "#FFFFFF"
graphiteColor
string "#171717"
strokeWidth
number 1 0.35–3
hatchStrength
number 1 0–2
roughness
number 1 0–2
shading
number 1 0–2
vignette
number 1 0–1
paused
boolean false
interactive
boolean false
maxDpr
number 2 1–3
resolutionScale
number 1 0.25–1
onReady
(backend: ShaderBackend) => void webgpu, webgl
onRendererChange
(backend: ShaderBackend, reason: string) => void webgl
onError
(error: Error) => void
bind:this
Component public instance pause, resume, reset, resize, destroy

Types below match the selected React component.

Property Type Default Range / values
className
string
svgSource
string Inline SVG, URL, or data URL
speed
number 0 0–2
scale
number 1 0.2–2
offsetX
number 0 -0.5–0.5
offsetY
number 0 -0.5–0.5
rotation
number 0 -180–180
paperColor
string "#FFFFFF"
graphiteColor
string "#171717"
strokeWidth
number 1 0.35–3
hatchStrength
number 1 0–2
roughness
number 1 0–2
shading
number 1 0–2
vignette
number 1 0–1
paused
boolean false
interactive
boolean false
maxDpr
number 2 1–3
resolutionScale
number 1 0.25–1
onReady
(backend: ShaderBackend) => void webgpu, webgl
onRendererChange
(backend: ShaderBackend, reason: string) => void webgl
onError
(error: Error) => void
ref
PencilLogoHandle pause, resume, reset, resize, destroy

Types below match the selected Vue component.

Property Type Default Range / values
class
string
svgSource
string Inline SVG, URL, or data URL
speed
number 0 0–2
scale
number 1 0.2–2
offsetX
number 0 -0.5–0.5
offsetY
number 0 -0.5–0.5
rotation
number 0 -180–180
paperColor
string "#FFFFFF"
graphiteColor
string "#171717"
strokeWidth
number 1 0.35–3
hatchStrength
number 1 0–2
roughness
number 1 0–2
shading
number 1 0–2
vignette
number 1 0–1
paused
boolean false
interactive
boolean false
maxDpr
number 2 1–3
resolutionScale
number 1 0.25–1
@ready
(backend: ShaderBackend) => void webgpu, webgl
@rendererchange
(backend: ShaderBackend, reason: string) => void webgl
@error
(error: Error) => void
ref
Component public instance pause, resume, reset, resize, destroy