Canvas

Glass Pane

A refractive view simulating moving glass rods that distort the underlying texture with chromatic aberration.


Installation

Install the component

Run the following command to install the component and its dependencies:
npx @motion-core/cli add glass-pane

Import the component

Import the component into your Svelte file:
import { GlassPane } from "$lib/motion-core";
import { GlassPane } from "$lib/motion-core";

Usage

Props

0.500
0.005
0.000
0.500
3
<script lang="ts">
	import { GlassPane } from "motion-core";
	import type { ComponentProps } from "svelte";

	const demoImage = "/images/demos/sample-6.jpg";
	type Props = Partial<ComponentProps<typeof GlassPane>>;

	let {
		distortion = 0.5,
		chromaticAberration = 0.005,
		waviness = 0,
		speed = 0.5,
		rods = 3,
	}: Props = $props();
</script>

<GlassPane
	image={demoImage}
	class="h-full min-h-96 w-full"
	{distortion}
	{chromaticAberration}
	{waviness}
	{speed}
	{rods}
/>

Props

GlassPane

PropTypeDefault
image
string
distortion
number 1.0
chromaticAberration
number 0.005
waviness
number 0.05
frequency
number 6.0
rods
number 5.0
speed
number 1.0
class
string ""