Crystal Prism Spin Card
A faceted crystal prism that floats and rotates, splitting light into spectral colors. Hover accelerates the spin and shifts the rainbow refraction pattern. Clicking changes the prism cut, revealing a new set of angular facets and light paths.
Crystal Prism Spin Card
by FreeCsStyles Dev's
CardsSpin / Rotation / Flip
🌐HTML/CSS🎨Tailwind⚛️React💚Vue🅰️Angular🔥Svelte☁️LWC
#crystal#prism#rainbow#gem#light#refraction#spectrum#sparkle#facet#rotate
Embed this component
Paste this snippet into any site — the design renders in a sandboxed iframe served from /embed/crystal-prism-spin-card.
<iframe src="/embed/crystal-prism-spin-card" sandbox="allow-scripts" loading="lazy" title="Crystal Prism Spin Card" style="border:0;width:100%;height:480px;overflow:hidden"></iframe>Implementation code
Copy the HTML and CSS for Crystal Prism Spin Card, or grab a framework-specific implementation. The HTML and CSS variants are self-contained; framework variants assume that framework's project setup.
HTML
<div class="crystal-prism-card">
<div class="prism-facets">
<div class="prism-facet" style="--i:0"></div>
<div class="prism-facet" style="--i:1"></div>
<div class="prism-facet" style="--i:2"></div>
<div class="prism-facet" style="--i:3"></div>
<div class="prism-facet" style="--i:4"></div>
<div class="prism-facet" style="--i:5"></div>
</div>
<div class="prism-spectrum"></div>
<div class="prism-content">
<div class="prism-title">Crystal Prism</div>
<div class="prism-sub">Hexagonal Cut</div>
<div class="prism-badge">SPIN</div>
</div>
</div>CSS
.crystal-prism-card { position: relative; width: 220px; min-height: 290px; border-radius: 16px; background: linear-gradient(160deg, #0a0a1a, #050510); border: 1.5px solid rgba(100,100,255,0.12); overflow: hidden; cursor: pointer; }
.crystal-prism-card:hover { box-shadow: 0 0 40px rgba(100,100,255,0.08); }
.prism-facets { position: absolute; inset: 20px; z-index: 1; transform-style: preserve-3d; animation: prismSpin 10s linear infinite; }
.crystal-prism-card:hover .prism-facets { animation-duration: 3s; }
@keyframes prismSpin { 0% { transform: rotateX(0deg) rotateY(0deg); } 100% { transform: rotateX(360deg) rotateY(360deg); } }
.prism-facet { position: absolute; left: 50%; top: 50%; width: 60px; height: 60px; background: linear-gradient(135deg, rgba(100,100,255,0.15), rgba(200,100,255,0.08)); clip-path: polygon(50% 0%, 100% 100%, 0% 100%); transform: translate(-50%,-50%) rotate(calc(var(--i) * 60deg)) translateY(-30px); }
.prism-spectrum { position: absolute; inset: 0; z-index: 2; pointer-events: none; background: conic-gradient(from 0deg, #ff0000, #ff8800, #ffff00, #00ff00, #0088ff, #8800ff, #ff0000); opacity: 0.06; border-radius: 16px; transition: opacity 0.5s; }
.crystal-prism-card:hover .prism-spectrum { opacity: 0.15; }
.prism-content { position: absolute; inset-x: 0; bottom: 0; z-index: 10; padding: 16px; background: linear-gradient(0deg, rgba(0,0,0,0.7), transparent); }
.prism-title { font-size: 14px; font-weight: 700; color: rgba(255,255,255,0.9); }
.prism-sub { font-size: 10px; color: rgba(100,100,255,0.5); }
.prism-badge { font-size: 7px; font-weight: 700; letter-spacing: 0.2em; color: rgba(100,100,255,0.4); margin-top: 4px; }Tailwind CSS
<div class="group relative w-[220px] min-h-[290px] rounded-2xl bg-gradient-to-b from-[#0a0a1a] to-[#050510] border border-indigo-500/20 overflow-hidden cursor-pointer group-hover:shadow-[0_0_40px_rgba(100,100,255,0.08)]">
<div class="absolute inset-5 [transform-style:preserve-3d] animate-[prismSpin_10s_linear_infinite] group-hover:animate-[prismSpin_3s_linear_infinite]">
{[...Array(6)].map((_, i) => (
<div key={i} className="absolute left-1/2 top-1/2 w-14 h-14 -translate-x-1/2 -translate-y-1/2 bg-gradient-to-br from-indigo-500/20 to-purple-500/10" style={{ clipPath: 'polygon(50% 0%, 100% 100%, 0% 100%)', transform: 'translate(-50%,-50%) rotate(' + (i * 60) + 'deg) translateY(-30px)' }}></div>
))}
</div>
<div class="absolute inset-0 pointer-events-none bg-conic from-red-500 via-yellow-500 via-green-500 via-blue-500 to-red-500 opacity-[0.06] rounded-2xl transition-opacity group-hover:opacity-[0.15]"></div>
<div class="absolute inset-x-0 bottom-0 z-10 p-4 bg-gradient-to-t from-black/70 to-transparent">
<p class="text-sm font-bold text-white/90">Crystal Prism</p>
<p class="text-[10px] text-indigo-500/50">Hexagonal Cut</p>
<p class="text-[7px] font-bold tracking-widest text-indigo-500/40 mt-1">SPIN</p>
</div>
</div>React
import React, { useRef, useState } from 'react';
import { motion, useMotionValue, useSpring } from 'framer-motion';
export function CrystalPrismCard({ width = 220 }) {
const ref = useRef(null);
const [isHovered, setIsHovered] = useState(false);
const [cut, setCut] = useState(0);
const x = useMotionValue(0);
const y = useMotionValue(0);
const rotateX = useSpring(y, { damping: 25, stiffness: 250 });
const rotateY = useSpring(x, { damping: 25, stiffness: 250 });
const handleMouseMove = (e) => {
if (!ref.current) return;
const rect = ref.current.getBoundingClientRect();
x.set(-((e.clientX - rect.left - rect.width / 2) / (rect.width / 2)) * 8);
y.set(((e.clientY - rect.top - rect.height / 2) / (rect.height / 2)) * 8);
};
const facets = 6;
return (
<div onMouseEnter={() => setIsHovered(true)} onMouseLeave={() => { setIsHovered(false); x.set(0); y.set(0); }}>
<motion.div ref={ref} onMouseMove={handleMouseMove} onClick={() => setCut((c) => (c + 1) % 3)} style={{ rotateX, rotateY, transformStyle: 'preserve-3d' }} className="relative cursor-pointer">
<motion.div className="relative overflow-hidden rounded-2xl" style={{ width, minHeight: 290, background: 'linear-gradient(160deg, #0a0a1a, #050510)', border: '1.5px solid rgba(100,100,255,0.12)' }}>
<motion.div className="absolute inset-5" style={{ transformStyle: 'preserve-3d' }}
animate={{ rotateZ: isHovered ? 360 : 0 }} transition={{ duration: isHovered ? 3 : 10, repeat: Infinity, ease: 'linear' }}>
{[...Array(facets)].map((_, i) => (
<motion.div key={i} className="absolute left-1/2 top-1/2 w-14 h-14" style={{ background: 'linear-gradient(135deg, rgba(100,100,255,0.15), rgba(200,100,255,0.08))', clipPath: 'polygon(50% 0%, 100% 100%, 0% 100%)', transform: 'translate(-50%,-50%) rotate(' + (i * 60) + 'deg) translateY(-30px)' }} />
))}
</motion.div>
<div className="absolute inset-0 pointer-events-none" style={{ background: 'conic-gradient(from 0deg, #ff0000, #ff8800, #ffff00, #00ff00, #0088ff, #8800ff, #ff0000)', opacity: isHovered ? 0.15 : 0.06, borderRadius: '16px' }} />
<div className="absolute inset-x-0 bottom-0 z-10 p-4" style={{ background: 'linear-gradient(0deg, rgba(0,0,0,0.7), transparent)' }}>
<p className="text-sm font-bold" style={{ color: 'rgba(255,255,255,0.9)' }}>Crystal Prism</p>
<p className="text-[10px]" style={{ color: 'rgba(100,100,255,0.5)' }}>{['Hexagonal', 'Octagonal', 'Diamond'][cut]} Cut</p>
</div>
</motion.div>
</motion.div>
</div>
);
}Where Crystal Prism Spin Card fits
- Gemstone Showcase
- Lighting Visualizers
- Premium Product Cards
- Jewelry UI
- Art Portfolios
Interaction states & animations
- Faceted prism rotation
- Rainbow refraction sweep
- Light spectrum dispersion
- Crystal cut morphing
- Sparkle particles
Topics
- #crystal
- #prism
- #rainbow
- #gem
- #light
- #refraction
- #spectrum
- #sparkle
- #facet
- #rotate
Accessibility notes
Rainbow and spin animations can be disabled with prefers-reduced-motion. Text remains readable on solid background.
Browser support
- Chrome 76+
- Firefox 90+
- Safari 13+
- Edge 79+