Melt Glass
A glass object that floats over your headline, image or video and bends it like real glass. It follows the pointer, wobbles when it moves and melts into the next shape on click.
pixikit.com/docs/components/melt-glass
Customize
Fit
Background
Text color
Font weight600
Font size0px
Shape
Morph on click
Size260px
Interaction
Position x0.50
Position y0.50
Refraction1.00
Dispersion0.35
Frost0.00
Color
Tint0.00
Reflection1.00
Shadow0.50
Elevation0.40
Smoothness0.50
Wobble0.50
Spin0.30
Idle
Intro
Max device pixel ratio2.00
Props
32| Name | Type | Default | Description |
|---|---|---|---|
text | string | "Look closer." | The headline drawn behind the glass, so the glass can bend it; use \n for line breaks. |
src | string | None | An image or video behind the glass; videos play muted on a loop. Files from another site need CORS headers. |
fit | "cover" | "contain" | "cover" | How the image or video fills the area. |
background | string | "transparent" | The colour behind the text and media; transparent lets the page show through. |
textColor | string | "" | The colour of the text; inherited when empty. |
fontFamily | string | "" | The font of the text; inherited when empty. |
fontWeight | number | string | 600 | The weight of the text. |
fontSize | number | 0 | The size of the text in px; 0 scales it to fill the width. |
shape | Shape | "torus" | The shape of the glass; changing it melts the glass smoothly into the new one. |
shapes | string[] | SHAPES | The shapes the glass cycles through when clicked. |
morphOnClick | boolean | true | A click on the glass melts it into the next shape. |
size | number | 260 | The diameter of the glass in px; it shrinks to fit small areas. |
interaction | "follow" | "drag" | "static" | "follow" | How the glass responds: it glides after the pointer, can be picked up and thrown, or stays in place. |
positionX | number | 0.5 | Where the glass rests across the width, 0 to 1. |
positionY | number | 0.5 | Where the glass rests down the height, 0 to 1. |
refraction | number | 1 | How strongly the glass bends light, 0 to 2; around 0.66 behaves like water. |
dispersion | number | 0.35 | How much light splits into rainbow fringes at the edges, 0 to 1. |
frost | number | 0 | Frosts the glass so what is behind it blurs, 0 to 1. |
color | string | "#ffffff" | The colour of the glass. |
tint | number | 0 | How strongly the glass takes on its colour; thicker parts look deeper. |
reflection | number | 1 | The strength of the highlights and reflections on the surface, 0 to 2. |
shadow | number | 0.5 | The strength of the shadow and the focused light the glass casts below it, 0 to 1. |
elevation | number | 0.4 | How high the glass floats above the content; higher magnifies more, until the image flips. |
smoothness | number | 0.5 | How lazily the glass follows, 0 snappy to 1 floaty. |
wobble | number | 0.5 | How much the glass stretches when it moves and wobbles when it stops; 0 keeps it rigid. |
spin | number | 0.3 | The idle rotation speed for shapes like the cube and the torus; negative spins the other way. |
idle | boolean | true | The glass drifts gently around its resting place while nobody interacts. |
intro | boolean | true | The glass pops into place on mount. |
maxDevicePixelRatio | number | 2 | The highest pixel ratio the canvas renders at. |
children | ReactNode | None | Content layered on top, such as buttons; it sits above the glass and is not bent by it. |
className | string | None | |
style | CSSProperties | None | Inline styles for the container. |