Skip to content
PixiKit

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
NameTypeDefaultDescription
textstring"Look closer."The headline drawn behind the glass, so the glass can bend it; use \n for line breaks.
srcstringNoneAn 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.
backgroundstring"transparent"The colour behind the text and media; transparent lets the page show through.
textColorstring""The colour of the text; inherited when empty.
fontFamilystring""The font of the text; inherited when empty.
fontWeightnumber | string600The weight of the text.
fontSizenumber0The size of the text in px; 0 scales it to fill the width.
shapeShape"torus"The shape of the glass; changing it melts the glass smoothly into the new one.
shapesstring[]SHAPESThe shapes the glass cycles through when clicked.
morphOnClickbooleantrueA click on the glass melts it into the next shape.
sizenumber260The 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.
positionXnumber0.5Where the glass rests across the width, 0 to 1.
positionYnumber0.5Where the glass rests down the height, 0 to 1.
refractionnumber1How strongly the glass bends light, 0 to 2; around 0.66 behaves like water.
dispersionnumber0.35How much light splits into rainbow fringes at the edges, 0 to 1.
frostnumber0Frosts the glass so what is behind it blurs, 0 to 1.
colorstring"#ffffff"The colour of the glass.
tintnumber0How strongly the glass takes on its colour; thicker parts look deeper.
reflectionnumber1The strength of the highlights and reflections on the surface, 0 to 2.
shadownumber0.5The strength of the shadow and the focused light the glass casts below it, 0 to 1.
elevationnumber0.4How high the glass floats above the content; higher magnifies more, until the image flips.
smoothnessnumber0.5How lazily the glass follows, 0 snappy to 1 floaty.
wobblenumber0.5How much the glass stretches when it moves and wobbles when it stops; 0 keeps it rigid.
spinnumber0.3The idle rotation speed for shapes like the cube and the torus; negative spins the other way.
idlebooleantrueThe glass drifts gently around its resting place while nobody interacts.
introbooleantrueThe glass pops into place on mount.
maxDevicePixelRationumber2The highest pixel ratio the canvas renders at.
childrenReactNodeNoneContent layered on top, such as buttons; it sits above the glass and is not bent by it.
classNamestringNone
styleCSSPropertiesNoneInline styles for the container.

Related