Distortion✨ Premium

Crystal Effect

A translucent hexagonal crystal with blue, violet and green tints, slowly turning on itself in a light perspective, wrapped in a bluish glow.

CSS3DLuxury

Updated

This effect is part of Effect.Labs — 840 vanilla effects, some free, some premium. Distortion has 31 effects, including 5 free. Explore the category →

3 usage examples

Gem found when opening a chest in a mining game (Profondrine) — Crystal Effect example 1

① Gem found when opening a chest in a mining game (Profondrine)

WhenDeep in a gallery the player opens the chest: an amethyst appears above it and spins, with a "+1 amethyst" tag and an inventory slot filling up.
WhyThe slow turn and violet glow turn plain loot into a reward worth looking at.
Settings72×96 px crystal, one round trip every 4 s, violet tints and glow (--xtl-tint-1 to --xtl-tint-3, --xtl-glow), root without background. Opening the chest and revealing the gem are handled by the page.
Small crystal in a jeweller's header logo (Maison Ystrelle) — Crystal Effect example 2

② Small crystal in a jeweller's header logo (Maison Ystrelle)

WhenLeft of the house name, in a dark header, the crystal turns slowly above the new collection and its three rings.
WhyOne moving detail is enough to give the brand some sparkle without pulling attention from the products.
Settings28×38 px crystal, one round trip every 6 s, default colours, placed in the home link that carries the name for screen readers.
Large crystal behind a collectors' club sign-in screen (Géodaline) — Crystal Effect example 3

③ Large crystal behind a collectors' club sign-in screen (Géodaline)

WhenThe sign-in form sits on the left; on the right a crystal over 300 px tall turns slowly in the background, next to the panel.
WhyThe decor nods to the members' hobby without adding anything to the form, which stays readable on its dark panel.
Settings236×314 px crystal, perspective raised to 900 px, one round trip every 12 s, stronger glow (rgba(100,200,255,.4)).

How it works

The .xtl-shape (150×200 px) is cut into a hexagon with clip-path. It stacks two layers: a white gradient (40%, 10%, 30%) with an inner white glow, then, inset by 3 px, a blue, violet and green gradient that gives the crystal its colour.

The xtlTurn animation spins it on the vertical axis from 0 to 180° and back over 10 seconds, with a small 5° forward and backward tilt. Halfway through, the crystal shows its edge and gets very thin before showing its back face.

Two repairs: the .xtl-crystal container now has a 600 px perspective (without it the turn looked like a mere squash), and the bluish glow comes from filter: drop-shadow on that container. It used to be a shadow of the shape itself, entirely cut away by the clipping and therefore invisible.

Accessibility

  • Decorative: the crystal has aria-hidden="true"; it carries no text or role. If you use it as a logo, put the name in the link around it.
  • Reduced motion: with prefers-reduced-motion: reduce the crystal stops slightly turned (25°), which keeps a sense of volume (measured: 2 looping animations → 0 for two copies).
  • No flashing: the turn is slow and the colours stay pale; the edge-on moment causes no flash.
  • Contrast: the faces are white and see-through; on a light background the crystal nearly vanishes. Use a dark background or denser colours.

Browser compatibility

CSS only, no JavaScript. Measured in Chromium 151 and Firefox 153: 0 errors, turn in perspective, visible glow, two independent copies, nothing overflowing at 390 px. In Playwright's WebKit 26.5 a frozen mid-turn frame looks like Chromium's, but that tool is not a reliable reference for CSS 3D, so the perspective remains unverified for Safari.

Chrome 87+✓ Full (measured)
Firefox 66+✓ Full (measured)
Safari 14.1+✓ Not verified for the perspective (clipping, colours and glow measured in WebKit)
Edge 87+✓ Full (Chromium engine)
Safari iOS 14.5+✓ Not verified for the perspective
Chrome Android 87+✓ Full (Chromium engine)

Without clip-path the crystal becomes a rectangle with the same gradients; without 3D transforms it narrows and widens with no depth.

The code

HTML structure to paste into your page (the CSS + JS come with your purchase):

index.html — structure
<div class="fx-0268-root">
  <div class="xtl-crystal" aria-hidden="true">
    <div class="xtl-shape"></div>
  </div>
</div>

One-time payment, no subscription — the code is yours forever

Customize

Options passed to the API or data-* attributes:

Option / propertyDefaultEffect
--xtl-w and --xtl-h 150px and 200px Crystal size (it never gets wider than its container).
--xtl-depth 600px Perspective: smaller makes the turn more dramatic; none brings back the old flat look.
--xtl-speed 10s Length of a full round trip (0 → 180° → 0).
--xtl-face-1 to --xtl-face-3 white at 40%, 10%, 30% Gradient of the outer layer, which makes the highlights.
--xtl-tint-1 to --xtl-tint-3 blue at 30%, violet at 20%, green at 30% Colour of the crystal's core: violet for an amethyst, pink for a quartz.
--xtl-glow rgba(100,200,255,.3) Colour of the glow around the crystal; transparent removes it.
--xtl-bg and --xtl-min-h #0a0a0f and 300px Root background and minimum height; transparent and 0 for a logo or an icon.

FAQ

It is a flat shape turning: at 90° you see it edge-on. Each edge-on moment lasts under a second; a slower cycle (--xtl-speed) makes it even less noticeable.
No, the effect draws two layers inside the same hexagonal cut. More facets would need extra clipped shapes, which this code does not include.
Yes: place the root inside a link that also holds the name (or an aria-label). Since the crystal is hidden from screen readers, the link carries the information.