Gravity Field Button
Everything inside the button is pulled toward the cursor creating a gravitational interactive effect
Embed this component
Paste this snippet into any site — the design renders in a sandboxed iframe served from /embed/gravity-field-button.
<iframe src="/embed/gravity-field-button" sandbox="allow-scripts" loading="lazy" title="Gravity Field Button" style="border:0;width:100%;height:480px;overflow:hidden"></iframe>Implementation code
Copy the HTML and CSS for Gravity Field Button, or grab a framework-specific implementation. The HTML and CSS variants are self-contained; framework variants assume that framework's project setup.
HTML
<button class="gravity-btn"><span>⚡ GRAVITY</span></button>CSS
.gravity-btn {
position: relative;
padding: 1rem 2rem;
border-radius: 0.75rem;
font-weight: 700;
letter-spacing: 0.05em;
background: radial-gradient(ellipse at 50% 50%, #1e293b, #0f172a);
color: #f1f5f9;
border: 1px solid rgba(255,255,255,0.1);
cursor: pointer;
overflow: hidden;
transition: all 0.3s ease;
}
.gravity-btn:hover { transform: scale(1.04); box-shadow: 0 20px 50px rgba(0,0,0,0.4); }
.gravity-btn:active { transform: scale(0.95); }
.gravity-btn::before {
content: ''; position: absolute; inset: 0; border-radius: 0.75rem;
background: radial-gradient(circle at 50% 50%, rgba(99,102,241,0.1), transparent 70%);
animation: gravity-pull 4s ease-in-out infinite;
pointer-events: none;
}
@keyframes gravity-pull { 0%,100% { transform: scale(1); opacity: 0.3; } 25% { transform: scale(1.2); opacity: 0.6; } 50% { transform: scale(0.9); opacity: 0.2; } 75% { transform: scale(1.15); opacity: 0.5; } }Tailwind CSS
<button class="px-8 py-4 rounded-xl font-bold tracking-wider bg-[radial-gradient(ellipse_at_50%_50%,#1e293b,#0f172a)] text-slate-100 border border-white/10 hover:scale-104 active:scale-95 transition-all overflow-hidden relative">
<span class="relative z-10">⚡ GRAVITY</span>
<div class="absolute inset-0 rounded-xl bg-[radial-gradient(circle_at_50%_50%,rgba(99,102,241,0.1),transparent_70%)] pointer-events-none" style="animation: gravity-pull 4s ease-in-out infinite;" />
</button>React
function GravityButton() {
return (
<motion.button
className="px-8 py-4 rounded-xl font-bold tracking-wider relative overflow-hidden"
style={{ background: 'radial-gradient(ellipse at 50% 50%, #1e293b, #0f172a)', color: '#f1f5f9', border: '1px solid rgba(255,255,255,0.1)', cursor: 'pointer' }}
whileHover={{ scale: 1.04, boxShadow: '0 20px 50px rgba(0,0,0,0.4)', transition: { type: 'spring', stiffness: 200, damping: 8 } }}
whileTap={{ scale: 0.95 }}
>
<span style={{ position: 'relative', zIndex: 10 }}>⚡ GRAVITY</span>
<motion.div style={{ position: 'absolute', inset: 0, borderRadius: '0.75rem', background: 'radial-gradient(circle at 50% 50%, rgba(99,102,241,0.1), transparent 70%)' }}
animate={{ scale: [1, 1.2, 0.9, 1.15, 1], opacity: [0.3, 0.6, 0.2, 0.5, 0.3] }}
transition={{ duration: 4, repeat: Infinity, ease: 'easeInOut' }}
/>
</motion.button>
);
}LWC — HTML template
<template><button class="gravity-btn" onclick={handleClick}><span style="position:relative;z-index:10"><slot>⚡ GRAVITY</slot></span></button></template>LWC — JavaScript
import { LightningElement, api } from 'lwc';
export default class GravityButton extends LightningElement {
@api label = '⚡ GRAVITY';
handleClick() { this.dispatchEvent(new CustomEvent('buttonclick', { bubbles: true, composed: true })); }
}LWC — CSS
.gravity-btn { position: relative; padding: 1rem 2rem; border-radius: 0.75rem; font-weight: 700; letter-spacing: 0.05em; background: radial-gradient(ellipse at 50% 50%, #1e293b, #0f172a); color: #f1f5f9; border: 1px solid rgba(255,255,255,0.1); cursor: pointer; overflow: hidden; transition: all 0.3s ease; }
.gravity-btn:hover { transform: scale(1.04); box-shadow: 0 20px 50px rgba(0,0,0,0.4); }
.gravity-btn:active { transform: scale(0.95); }
.gravity-btn::before { content: ''; position: absolute; inset: 0; border-radius: 0.75rem; background: radial-gradient(circle at 50% 50%, rgba(99,102,241,0.1), transparent 70%); animation: gravity-pull 4s ease-in-out infinite; pointer-events: none; }
@keyframes gravity-pull { 0%,100% { transform: scale(1); opacity: 0.3; } 25% { transform: scale(1.2); opacity: 0.6; } 50% { transform: scale(0.9); opacity: 0.2; } 75% { transform: scale(1.15); opacity: 0.5; } }LWC — Configuration
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>59.0</apiVersion>
<isExposed>true</isExposed>
<targets><target>lightning__AppPage</target><target>lightning__RecordPage</target><target>lightning__HomePage</target></targets>
</LightningComponentBundle>Where Gravity Field Button fits
- Premium Landing Pages
- Games
- Interactive Experiences
- Creative Portfolios
Interaction states & animations
- Gravity
- Spring Physics
- Elastic Return
- Parallax
Topics
- #gravity
- #physics
- #spring
- #interactive
- #cursor
- #parallax
Accessibility notes
Gravity effect is decorative - provide non-motion fallback. Must work with keyboard-only navigation.
Browser support
- All modern browsers