Magnetic Force Pricing
An interactive pricing table with magnetic force effects, attraction-based animations, and physics-inspired design
Responsive Design
Yes
Dark Mode Support
No
lines
652
Browser Compatibility
No
Live Preview
Interact with the component without leaving the page.
Magnetic Force Pricing Component
An interactive pricing table with magnetic force effects, attraction-based animations, and physics-inspired design for a scientifically engaging experience.
Features
- Magnetic Force Effects: Physics-based animations that simulate magnetic attraction and repulsion
- Attraction-based Animations: Elements respond to cursor proximity with realistic force interactions
- Physics-inspired Design: Scientifically accurate movement using distance calculations and transforms
- Force Visualization: Visual representation of magnetic field lines and force vectors
- Glowing Elements: Neon-like glowing elements using layered text and box shadows
- Performance Optimized: Hardware-accelerated animations for smooth 60fps performance
HTML Structure
<div class="magnetic-force-pricing-container">
<div class="pricing-header">
<h2 class="pricing-title">Magnetic Force Pricing</h2>
<p class="pricing-subtitle">Attracting plans with magnetic force</p>
</div>
<div class="pricing-toggle">
<span class="toggle-label">MONTHLY</span>
<label class="switch">
<input type="checkbox" id="billing-toggle">
<span class="slider"></span>
</label>
<span class="toggle-label">YEARLY</span>
<span class="discount-badge">SAVE 25%</span>
</div>
<div class="pricing-grid">
<div class="pricing-card" data-magnetic>
<div class="force-base"></div>
<div class="card-force">
<div class="card-header">
<div class="magnetic-dot"></div>
<h3 class="plan-name">FORCE</h3>
<p class="plan-description">FOR INDIVIDUAL USERS</p>
</div>
<div class="card-price">
<span class="currency">$</span>
<span class="amount" data-monthly="24" data-yearly="18">24</span>
<span class="period">/MONTH</span>
</div>
<ul class="features-list">
<li class="feature-item">
<div class="feature-dot"></div>
<span class="feature-text">3 PROJECTS</span>
</li>
<li class="feature-item">
<div class="feature-dot"></div>
<span class="feature-text">10GB STORAGE</span>
</li>
<li class="feature-item">
<div class="feature-dot"></div>
<span class="feature-text">BASIC SUPPORT</span>
</li>
<li class="feature-item disabled">
<div class="feature-dot disabled"></div>
<span class="feature-text">API ACCESS</span>
</li>
<li class="feature-item disabled">
<div class="feature-dot disabled"></div>
<span class="feature-text">CUSTOM DOMAIN</span>
</li>
</ul>
<button class="select-button">SELECT PLAN</button>
</div>
</div>
<div class="pricing-card popular" data-magnetic>
<div class="force-base"></div>
<div class="card-force">
<div class="popular-badge">MOST POPULAR</div>
<div class="card-header">
<div class="magnetic-dot"></div>
<h3 class="plan-name">ATTRACTION</h3>
<p class="plan-description">FOR GROWING TEAMS</p>
</div>
<div class="card-price">
<span class="currency">$</span>
<span class="amount" data-monthly="59" data-yearly="44.25">59</span>
<span class="period">/MONTH</span>
</div>
<ul class="features-list">
<li class="feature-item">
<div class="feature-dot"></div>
<span class="feature-text">5 PROJECTS</span>
</li>
<li class="feature-item">
<div class="feature-dot"></div>
<span class="feature-text">100GB STORAGE</span>
</li>
<li class="feature-item">
<div class="feature-dot"></div>
<span class="feature-text">PRIORITY SUPPORT</span>
</li>
<li class="feature-item">
<div class="feature-dot"></div>
<span class="feature-text">API ACCESS</span>
</li>
<li class="feature-item disabled">
<div class="feature-dot disabled"></div>
<span class="feature-text">CUSTOM DOMAIN</span>
</li>
</ul>
<button class="select-button">SELECT PLAN</button>
</div>
</div>
<div class="pricing-card" data-magnetic>
<div class="force-base"></div>
<div class="card-force">
<div class="card-header">
<div class="magnetic-dot"></div>
<h3 class="plan-name">REPULSION</h3>
<p class="plan-description">FOR LARGE ORGANIZATIONS</p>
</div>
<div class="card-price">
<span class="currency">$</span>
<span class="amount" data-monthly="129" data-yearly="96.75">129</span>
<span class="period">/MONTH</span>
</div>
<ul class="features-list">
<li class="feature-item">
<div class="feature-dot"></div>
<span class="feature-text">UNLIMITED PROJECTS</span>
</li>
<li class="feature-item">
<div class="feature-dot"></div>
<span class="feature-text">1TB STORAGE</span>
</li>
<li class="feature-item">
<div class="feature-dot"></div>
<span class="feature-text">24/7 DEDICATED SUPPORT</span>
</li>
<li class="feature-item">
<div class="feature-dot"></div>
<span class="feature-text">FULL API ACCESS</span>
</li>
<li class="feature-item">
<div class="feature-dot"></div>
<span class="feature-text">CUSTOM DOMAIN</span>
</li>
</ul>
<button class="select-button">CONTACT SALES</button>
</div>
</div>
</div>
</div>CSS Styles
.magnetic-force-pricing-container {
max-width: 1200px;
margin: 2rem auto;
padding: 2rem;
font-family: 'Inter', sans-serif;
background: #0f172a;
position: relative;
overflow: hidden;
border-radius: 20px;
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
min-height: 100vh;
}
.magnetic-force-pricing-container::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background:
radial-gradient(circle at 20% 30%, rgba(99, 102, 241, 0.1) 0%, transparent 40%),
radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.1) 0%, transparent 40%),
radial-gradient(circle at 40% 80%, rgba(236, 72, 153, 0.1) 0%, transparent 30%);
pointer-events: none;
animation: force-pulse 8s ease-in-out infinite;
}
.pricing-header {
text-align: center;
margin-bottom: 3rem;
position: relative;
z-index: 2;
}
.pricing-title {
font-size: 2.5rem;
margin-bottom: 0.5rem;
color: #e2e8f0;
text-shadow:
0 0 10px rgba(99, 102, 241, 0.7),
0 0 20px rgba(99, 102, 241, 0.5),
0 0 30px rgba(99, 102, 241, 0.3);
letter-spacing: 3px;
animation: title-glow 3s ease-in-out infinite alternate;
}
.pricing-subtitle {
color: #94a3b8;
font-size: 1.1rem;
text-shadow: 0 0 5px rgba(99, 102, 241, 0.5);
}
.pricing-toggle {
display: flex;
justify-content: center;
align-items: center;
gap: 1rem;
margin-bottom: 3rem;
position: relative;
z-index: 2;
}
.toggle-label {
font-size: 1rem;
color: #cbd5e1;
text-shadow: 0 0 3px rgba(99, 102, 241, 0.5);
font-weight: 500;
}
.switch {
position: relative;
display: inline-block;
width: 60px;
height: 30px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #1e293b;
border: 1px solid #334155;
transition: .4s;
border-radius: 34px;
}
.slider:before {
position: absolute;
content: "";
height: 22px;
width: 22px;
left: 4px;
bottom: 3px;
background: #6366f1;
transition: .4s;
border-radius: 50%;
box-shadow: 0 0 10px #6366f1;
}
input:checked + .slider {
background: #1e293b;
border-color: #6366f1;
}
input:checked + .slider:before {
transform: translateX(30px);
background: #8b5cf6;
box-shadow: 0 0 15px #8b5cf6;
}
.discount-badge {
background: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);
color: #000;
padding: 0.25rem 0.75rem;
border-radius: 20px;
font-size: 0.8rem;
font-weight: 600;
margin-left: 0.5rem;
text-shadow: none;
box-shadow: 0 4px 12px rgba(236, 72, 153, 0.4);
}
.pricing-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 2rem;
position: relative;
z-index: 2;
}
.pricing-card {
background: #1e293b;
border: 1px solid #334155;
border-radius: 16px;
overflow: hidden;
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
position: relative;
transform: translateZ(0);
will-change: transform;
}
.pricing-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background:
linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
pointer-events: none;
z-index: -1;
border-radius: 16px;
}
.pricing-card:hover {
background: #2d3748;
border-color: #6366f1;
box-shadow:
0 12px 40px rgba(0, 0, 0, 0.4),
0 0 20px rgba(99, 102, 241, 0.3);
transform: translateY(-5px);
}
.popular {
background: #334155;
border: 1px solid #6366f1;
box-shadow:
0 12px 40px rgba(0, 0, 0, 0.4),
0 0 25px rgba(99, 102, 241, 0.4);
}
.popular:hover {
background: #374151;
border-color: #8b5cf6;
box-shadow:
0 16px 48px rgba(0, 0, 0, 0.5),
0 0 30px rgba(139, 92, 246, 0.5);
transform: translateY(-10px);
}
.force-base {
position: absolute;
bottom: -20px;
left: 50%;
transform: translateX(-50%);
width: 150px;
height: 10px;
background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.8), transparent);
border-radius: 50%;
box-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
filter: blur(2px);
z-index: 1;
}
.card-force {
position: relative;
z-index: 2;
}
.card-header {
text-align: center;
margin-bottom: 2rem;
position: relative;
padding: 2rem 1.5rem 0;
}
.magnetic-dot {
width: 12px;
height: 12px;
border-radius: 50%;
background: #6366f1;
margin: 0 auto 1rem;
box-shadow: 0 0 10px #6366f1;
transition: all 0.3s ease;
}
.pricing-card:hover .magnetic-dot {
background: #8b5cf6;
transform: scale(1.3);
box-shadow: 0 0 15px #8b5cf6;
}
.popular-badge {
position: absolute;
top: 1rem;
right: -30px;
background: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);
color: #000;
padding: 0.25rem 2rem;
border-radius: 20px;
font-size: 0.8rem;
font-weight: 600;
text-shadow: none;
box-shadow: 0 4px 12px rgba(236, 72, 153, 0.4);
z-index: 3;
transform: rotate(45deg);
}
.plan-name {
font-size: 1.8rem;
margin-bottom: 0.5rem;
color: #e2e8f0;
text-shadow: 0 0 5px rgba(99, 102, 241, 0.5);
font-weight: 700;
}
.plan-description {
color: #94a3b8;
font-size: 0.9rem;
text-shadow: 0 0 3px rgba(99, 102, 241, 0.3);
}
.card-price {
text-align: center;
margin-bottom: 2rem;
padding: 0 1.5rem;
}
.currency {
font-size: 1.5rem;
color: #6366f1;
vertical-align: top;
text-shadow: 0 0 5px #6366f1;
}
.amount {
font-size: 3rem;
font-weight: 700;
color: #6366f1;
text-shadow:
0 0 10px #6366f1,
0 0 20px #6366f1;
animation: price-glow 3s ease-in-out infinite alternate;
}
.period {
color: #94a3b8;
font-size: 1rem;
text-shadow: 0 0 3px rgba(99, 102, 241, 0.3);
}
.features-list {
list-style: none;
padding: 0 1.5rem;
margin-bottom: 2rem;
}
.feature-item {
display: flex;
align-items: center;
padding: 0.75rem 0;
border-bottom: 1px solid #334155;
}
.feature-item:last-child {
border-bottom: none;
}
.feature-dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: #6366f1;
margin-right: 1rem;
flex-shrink: 0;
box-shadow: 0 0 5px #6366f1;
}
.feature-item:not(.disabled) .feature-dot {
background: #6366f1;
box-shadow: 0 0 5px #6366f1;
}
.feature-item.disabled .feature-dot {
background: #334155;
box-shadow: none;
}
.feature-text {
color: #cbd5e1;
font-size: 0.95rem;
text-shadow: 0 0 2px rgba(99, 102, 241, 0.3);
flex: 1;
}
.feature-item.disabled .feature-text {
color: #64748b;
text-shadow: none;
}
.select-button {
width: calc(100% - 3rem);
margin: 0 1.5rem 1.5rem;
padding: 1rem;
background: #334155;
border: 1px solid #475569;
border-radius: 12px;
font-size: 1rem;
font-weight: 600;
color: #6366f1;
cursor: pointer;
transition: all 0.3s ease;
text-shadow: 0 0 3px #6366f1;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.select-button:hover {
background: #475569;
border-color: #6366f1;
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
transform: translateY(-2px);
}
.pricing-card.magnetic-active {
border-color: #8b5cf6;
box-shadow:
0 0 30px rgba(139, 92, 246, 0.4),
0 0 40px rgba(99, 102, 241, 0.2);
}
.pricing-card.magnetic-active .select-button {
background: #475569;
border-color: #8b5cf6;
box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
}
@keyframes title-glow {
0% {
text-shadow:
0 0 10px rgba(99, 102, 241, 0.7),
0 0 20px rgba(99, 102, 241, 0.5),
0 0 30px rgba(99, 102, 241, 0.3);
}
100% {
text-shadow:
0 0 15px rgba(99, 102, 241, 0.8),
0 0 25px rgba(99, 102, 241, 0.6),
0 0 35px rgba(99, 102, 241, 0.4),
0 0 45px rgba(99, 102, 241, 0.2);
}
}
@keyframes force-pulse {
0%, 100% {
opacity: 0.3;
}
50% {
opacity: 0.6;
}
}
@keyframes price-glow {
0% {
text-shadow:
0 0 10px #6366f1,
0 0 20px #6366f1;
}
100% {
text-shadow:
0 0 15px #6366f1,
0 0 25px #6366f1,
0 0 35px #6366f1;
}
}
@media (max-width: 768px) {
.magnetic-force-pricing-container {
padding: 1rem;
}
.pricing-grid {
grid-template-columns: 1fr;
gap: 1.5rem;
}
.pricing-title {
font-size: 2rem;
}
.plan-name {
font-size: 1.5rem;
}
.popular {
transform: scale(1);
}
.popular:hover {
transform: translateY(-5px);
}
}JavaScript Functionality
document.addEventListener('DOMContentLoaded', function() {
const toggle = document.getElementById('billing-toggle');
const amounts = document.querySelectorAll('.amount');
toggle.addEventListener('change', function() {
amounts.forEach(amount => {
if (this.checked) {
amount.textContent = amount.getAttribute('data-yearly');
} else {
amount.textContent = amount.getAttribute('data-monthly');
}
});
});
// Magnetic force effect functionality
const pricingCards = document.querySelectorAll('.pricing-card[data-magnetic]');
pricingCards.forEach(card => {
// FAQ accordion functionality
const question = card.querySelector('.faq-question');
question.addEventListener('click', () => {
const isActive = card.classList.contains('active');
// Close all other items
pricingCards.forEach(otherCard => {
if (otherCard !== card) {
otherCard.classList.remove('active');
}
});
// Toggle current item
if (isActive) {
card.classList.remove('active');
} else {
card.classList.add('active');
}
});
// Magnetic force attraction effect
const handleMouseMove = (e) => {
const rect = card.getBoundingClientRect();
const x = e.clientX - rect.left;
const y = e.clientY - rect.top;
const centerX = rect.width / 2;
const centerY = rect.height / 2;
const distanceX = x - centerX;
const distanceY = y - centerY;
const distance = Math.sqrt(distanceX * distanceX + distanceY * distanceY);
const maxDistance = 200;
if (distance < maxDistance) {
const strength = 1 - (distance / maxDistance);
const moveX = (distanceX / maxDistance) * strength * 15;
const moveY = (distanceY / maxDistance) * strength * 15;
card.style.transform = `translate(${moveX}px, ${moveY}px)`;
card.classList.add('magnetic-active');
} else {
card.style.transform = 'translate(0, 0)';
card.classList.remove('magnetic-active');
}
};
const handleMouseLeave = () => {
card.style.transform = 'translate(0, 0)';
card.classList.remove('magnetic-active');
};
document.addEventListener('mousemove', handleMouseMove);
card.addEventListener('mouseleave', handleMouseLeave);
});
});Implementation Guide
- Copy the HTML structure into your project
- Add the CSS styles to your stylesheet
- Include the JavaScript code in your script file
- Customize the magnetic force strength and attraction effects to match your brand
- Update the pricing plans and features to reflect your offerings
The magnetic force pricing component features physics-based animations that simulate magnetic attraction and repulsion effects. The design uses scientifically accurate movement calculations and CSS transforms to create natural motion, with visual feedback indicating the magnetic force state for an immersive user experience.
HTML
136
lines
CSS
443
lines
JavaScript
73
lines
<div class="magnetic-force-pricing-container">
<div class="pricing-header">
<h2 class="pricing-title">Magnetic Force Pricing</h2>
<p class="pricing-subtitle">Attracting plans with magnetic force</p>
</div>
<div class="pricing-toggle">
<span class="toggle-label">MONTHLY</span>
<label class="switch">
<input type="checkbox" id="billing-toggle">
<span class="slider"></span>
</label>
<span class="toggle-label">YEARLY</span>
<span class="discount-badge">SAVE 25%</span>
</div>
<div class="pricing-grid">
<div class="pricing-card" data-magnetic>
<div class="force-base"></div>
<div class="card-force">
<div class="card-header">
<div class="magnetic-dot"></div>
<h3 class="plan-name">FORCE</h3>
<p class="plan-description">FOR INDIVIDUAL USERS</p>
</div>
<div class="card-price">
<span class="currency">\$</span>
<span class="amount" data-monthly="24" data-yearly="18">24</span>
<span class="period">/MONTH</span>
</div>
<ul class="features-list">
<li class="feature-item">
<div class="feature-dot"></div>
<span class="feature-text">3 PROJECTS</span>
</li>
<li class="feature-item">
<div class="feature-dot"></div>
<span class="feature-text">10GB STORAGE</span>
</li>
<li class="feature-item">
<div class="feature-dot"></div>
<span class="feature-text">BASIC SUPPORT</span>
</li>
<li class="feature-item disabled">
<div class="feature-dot disabled"></div>
<span class="feature-text">API ACCESS</span>
</li>
<li class="feature-item disabled">
<div class="feature-dot disabled"></div>
<span class="feature-text">CUSTOM DOMAIN</span>
</li>
</ul>
<button class="select-button">SELECT PLAN</button>
</div>
</div>
<div class="pricing-card popular" data-magnetic>
<div class="force-base"></div>
<div class="card-force">
<div class="popular-badge">MOST POPULAR</div>
<div class="card-header">
<div class="magnetic-dot"></div>
<h3 class="plan-name">ATTRACTION</h3>
<p class="plan-description">FOR GROWING TEAMS</p>
</div>
<div class="card-price">
<span class="currency">\$</span>
<span class="amount" data-monthly="59" data-yearly="44.25">59</span>
<span class="period">/MONTH</span>
</div>
<ul class="features-list">
<li class="feature-item">
<div class="feature-dot"></div>
<span class="feature-text">5 PROJECTS</span>
</li>
<li class="feature-item">
<div class="feature-dot"></div>
<span class="feature-text">100GB STORAGE</span>
</li>
<li class="feature-item">
<div class="feature-dot"></div>
<span class="feature-text">PRIORITY SUPPORT</span>
</li>
<li class="feature-item">
<div class="feature-dot"></div>
<span class="feature-text">API ACCESS</span>
</li>
<li class="feature-item disabled">
<div class="feature-dot disabled"></div>
<span class="feature-text">CUSTOM DOMAIN</span>
</li>
</ul>
<button class="select-button">SELECT PLAN</button>
</div>
</div>
<div class="pricing-card" data-magnetic>
<div class="force-base"></div>
<div class="card-force">
<div class="card-header">
<div class="magnetic-dot"></div>
<h3 class="plan-name">REPULSION</h3>
<p class="plan-description">FOR LARGE ORGANIZATIONS</p>
</div>
<div class="card-price">
<span class="currency">\$</span>
<span class="amount" data-monthly="129" data-yearly="96.75">129</span>
<span class="period">/MONTH</span>
</div>
<ul class="features-list">
<li class="feature-item">
<div class="feature-dot"></div>
<span class="feature-text">UNLIMITED PROJECTS</span>
</li>
<li class="feature-item">
<div class="feature-dot"></div>
<span class="feature-text">1TB STORAGE</span>
</li>
<li class="feature-item">
<div class="feature-dot"></div>
<span class="feature-text">24/7 DEDICATED SUPPORT</span>
</li>
<li class="feature-item">
<div class="feature-dot"></div>
<span class="feature-text">FULL API ACCESS</span>
</li>
<li class="feature-item">
<div class="feature-dot"></div>
<span class="feature-text">CUSTOM DOMAIN</span>
</li>
</ul>
<button class="select-button">CONTACT SALES</button>
</div>
</div>
</div>
</div>