Planetary Orbit Card
A cosmic card depicting a miniature solar system. Planets orbit a central star at different speeds along elliptical paths. Hovering zooms in on a specific planet, revealing its name and details. Clicking triggers a planetary alignment event.
Planetary Orbit Card
by FreeCsStyles Dev's
CardsSpin / Rotation / Flip
🌐HTML/CSS🎨Tailwind⚛️React💚Vue🅰️Angular🔥Svelte☁️LWC
#planet#orbit#space#solar-system#cosmos#rotation#astronomy#star#celestial#gravity
Embed this component
Paste this snippet into any site — the design renders in a sandboxed iframe served from /embed/planetary-orbit-card.
<iframe src="/embed/planetary-orbit-card" sandbox="allow-scripts" loading="lazy" title="Planetary Orbit Card" style="border:0;width:100%;height:480px;overflow:hidden"></iframe>Implementation code
Copy the HTML and CSS for Planetary Orbit 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="planet-orbit-card">
<div class="orbit-star"></div>
<div class="orbit-rings">
<div class="orbit-ring" style="--r:1"><div class="orbit-planet" style="--c:#ff6b6b"></div></div>
<div class="orbit-ring" style="--r:2"><div class="orbit-planet" style="--c:#ffd93d"></div></div>
<div class="orbit-ring" style="--r:3"><div class="orbit-planet" style="--c:#6bcbff"></div></div>
<div class="orbit-ring" style="--r:4"><div class="orbit-planet" style="--c:#a66cff"></div></div>
</div>
<div class="orbit-content">
<div class="orbit-title">Solar System</div>
<div class="orbit-sub">4 Planets in Orbit</div>
</div>
</div>CSS
.planet-orbit-card { position: relative; width: 220px; min-height: 290px; border-radius: 16px; background: linear-gradient(160deg, #0a0418, #020208); border: 1.5px solid rgba(100,80,200,0.15); overflow: hidden; cursor: pointer; }
.planet-orbit-card:hover { box-shadow: 0 0 30px rgba(100,80,200,0.1); }
.orbit-star { position: absolute; left: 50%; top: 35%; transform: translate(-50%,-50%); width: 24px; height: 24px; border-radius: 50%; background: radial-gradient(circle, #fff7a0, #ff8800); box-shadow: 0 0 20px rgba(255,200,50,0.6), 0 0 60px rgba(255,150,0,0.2); z-index: 2; animation: starPulse 2s ease-in-out infinite; }
@keyframes starPulse { 0%,100% { box-shadow: 0 0 20px rgba(255,200,50,0.6); } 50% { box-shadow: 0 0 30px rgba(255,200,50,0.9), 0 0 60px rgba(255,150,0,0.3); } }
.orbit-rings { position: absolute; left: 50%; top: 35%; transform: translate(-50%,-50%); z-index: 1; }
.orbit-ring { position: absolute; left: 50%; top: 50%; width: calc(var(--r) * 30px); height: calc(var(--r) * 30px); margin-left: calc(var(--r) * -15px); margin-top: calc(var(--r) * -15px); border-radius: 50%; border: 0.5px solid rgba(100,80,200,0.12); animation: orbitSpin calc(8s - var(--r) * 1s) linear infinite; }
@keyframes orbitSpin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.orbit-planet { position: absolute; right: -4px; top: 50%; transform: translateY(-50%); width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.orbit-content { position: absolute; inset-x: 0; bottom: 0; z-index: 10; padding: 16px; background: linear-gradient(0deg, rgba(0,0,0,0.7), transparent); }
.orbit-title { font-size: 14px; font-weight: 700; color: rgba(255,255,255,0.9); }
.orbit-sub { font-size: 9px; color: rgba(100,80,200,0.5); }Tailwind CSS
<div class="group relative w-[220px] min-h-[290px] rounded-2xl bg-gradient-to-b from-[#0a0418] to-[#020208] border border-indigo-500/20 overflow-hidden cursor-pointer group-hover:shadow-[0_0_30px_rgba(100,80,200,0.1)]">
<div class="absolute left-1/2 top-[35%] -translate-x-1/2 -translate-y-1/2 w-6 h-6 rounded-full bg-gradient-radial from-yellow-200 to-orange-500 shadow-[0_0_20px_rgba(255,200,50,0.6)] z-[2] animate-[starPulse_2s_ease-in-out_infinite]"></div>
{[1,2,3,4].map(r => (
<div key={r} className="absolute left-1/2 top-[35%] -translate-x-1/2 -translate-y-1/2 w-['+(r*30)+'px'] h-['+(r*30)+'px'] rounded-full border border-indigo-500/20 animate-[orbitSpin_'+ (8-r) +'s_linear_infinite]">
<div className={"absolute -right-1 top-1/2 -translate-y-1/2 w-2 h-2 rounded-full " + ["bg-red-400","bg-yellow-400","bg-blue-400","bg-purple-400"][r-1]}></div>
</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">Solar System</p>
<p class="text-[9px] text-indigo-500/50">4 Planets in Orbit</p>
</div>
</div>React
import React, { useRef, useState } from 'react';
import { motion, useMotionValue, useSpring } from 'framer-motion';
export function PlanetaryOrbitCard({ width = 220 }) {
const ref = useRef(null);
const [isHovered, setIsHovered] = useState(false);
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 planets = [{ color: '#ff6b6b', speed: 7 }, { color: '#ffd93d', speed: 6 }, { color: '#6bcbff', speed: 5 }, { color: '#a66cff', speed: 4 }];
const handleMouseMove = (e) => {
if (!ref.current) return;
const rect = ref.current.getBoundingClientRect();
x.set(-((e.clientX - rect.left - rect.width / 2) / (rect.width / 2)) * 6);
y.set(((e.clientY - rect.top - rect.height / 2) / (rect.height / 2)) * 6);
};
return (
<div onMouseEnter={() => setIsHovered(true)} onMouseLeave={() => { setIsHovered(false); x.set(0); y.set(0); }}>
<motion.div ref={ref} onMouseMove={handleMouseMove} 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, #0a0418, #020208)', border: '1.5px solid rgba(100,80,200,0.15)' }}>
<motion.div className="absolute left-1/2 top-[35%] -translate-x-1/2 -translate-y-1/2 w-6 h-6 rounded-full z-[2]" style={{ background: 'radial-gradient(circle, #fff7a0, #ff8800)', boxShadow: '0 0 20px rgba(255,200,50,0.6)' }}
animate={{ scale: isHovered ? [1, 1.15, 1] : 1 }} transition={{ duration: 2, repeat: Infinity }} />
{planets.map((p, i) => (
<motion.div key={i} className="absolute left-1/2 top-[35%] -translate-x-1/2 -translate-y-1/2" style={{ width: (i + 1) * 30, height: (i + 1) * 30, borderRadius: '50%', border: '0.5px solid rgba(100,80,200,0.12)' }}
animate={{ rotate: 360 }} transition={{ duration: p.speed, repeat: Infinity, ease: 'linear' }}>
<motion.div className="absolute -right-1 top-1/2 -translate-y-1/2 w-2 h-2 rounded-full"
style={{ background: p.color }}
animate={{ scale: isHovered ? [1, 1.5, 1] : 1 }} transition={{ duration: 1, repeat: Infinity, delay: i * 0.2 }} />
</motion.div>
))}
<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)' }}>Solar System</p>
<p className="text-[9px]" style={{ color: 'rgba(100,80,200,0.5)' }}>4 Planets in Orbit</p>
</div>
</motion.div>
</motion.div>
</div>
);
}Where Planetary Orbit Card fits
- Space Visualization
- Astronomy Education
- Science Cards
- Cosmic Dashboards
- Interactive Planets
Interaction states & animations
- Planetary orbit rotation
- Elliptical path tracing
- Star pulse
- Planet zoom on hover
- Alignment animation
Topics
- #planet
- #orbit
- #space
- #solar-system
- #cosmos
- #rotation
- #astronomy
- #star
- #celestial
- #gravity
Accessibility notes
Orbital motion may be distracting for some users. prefers-reduced-motion disables orbital animation and shows static positions.
Browser support
- Chrome 76+
- Firefox 90+
- Safari 13+
- Edge 79+