Files
swiper/scss/enhanced-animations.scss
Aodhan Collins 5e893a0c9d Bug fixes
2025-07-31 01:38:07 +01:00

462 lines
10 KiB
SCSS

/**
* Enhanced Physics-Based Animation Styles
* Supports the SwipePhysics engine and EnhancedSwipeCard component
*/
:root {
/* Physics Animation Variables */
--spring-gentle: cubic-bezier(0.25, 0.46, 0.45, 0.94);
--spring-bouncy: cubic-bezier(0.68, -0.55, 0.265, 1.55);
--spring-wobbly: cubic-bezier(0.175, 0.885, 0.32, 1.275);
--spring-stiff: cubic-bezier(0.55, 0.055, 0.675, 0.19);
--spring-smooth: cubic-bezier(0.4, 0.0, 0.2, 1);
/* Enhanced Color Palette */
--physics-primary: #667eea;
--physics-success: #f093fb;
--physics-danger: #ffecd2;
--physics-warning: #fcb69f;
/* Gradient Definitions */
--gradient-physics-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
--gradient-physics-success: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
--gradient-physics-danger: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
--gradient-physics-warning: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
/* Animation Timing */
--physics-duration-fast: 0.2s;
--physics-duration-normal: 0.4s;
--physics-duration-slow: 0.8s;
/* 3D Perspective */
--physics-perspective: 1200px;
--physics-depth: 100px;
}
/* Enhanced Card Styles */
.enhanced-card {
position: relative;
transform-style: preserve-3d;
backface-visibility: hidden;
will-change: transform, filter, opacity;
/* Subtle glow effect */
&::before {
content: '';
position: absolute;
top: -2px;
left: -2px;
right: -2px;
bottom: -2px;
background: var(--gradient-physics-primary);
border-radius: inherit;
z-index: -1;
opacity: 0;
transition: opacity var(--physics-duration-normal) var(--spring-smooth);
}
&.enhanced-swiping::before {
opacity: 0.3;
}
}
/* Enhanced Loading Animation */
.enhanced-loading {
.loading-indicator {
opacity: 1;
transform: translate(-50%, -50%) scale(1);
transition: all var(--physics-duration-normal) var(--spring-wobbly);
}
.physics-spinner {
width: 60px;
height: 60px;
border: 4px solid rgba(102, 126, 234, 0.2);
border-top-color: var(--physics-primary);
border-radius: 50%;
animation: physicsSpinnerRotate 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
position: relative;
&::after {
content: '';
position: absolute;
top: 2px;
left: 2px;
right: 2px;
bottom: 2px;
border: 2px solid transparent;
border-top-color: rgba(102, 126, 234, 0.6);
border-radius: 50%;
animation: physicsSpinnerRotate 0.6s linear infinite reverse;
}
}
.loading-text {
margin-top: 15px;
font-weight: 600;
color: var(--physics-primary);
animation: loadingPulse 1.5s ease-in-out infinite;
}
}
@keyframes physicsSpinnerRotate {
0% { transform: rotate(0deg) scale(1); }
50% { transform: rotate(180deg) scale(1.1); }
100% { transform: rotate(360deg) scale(1); }
}
@keyframes loadingPulse {
0%, 100% { opacity: 0.6; transform: scale(1); }
50% { opacity: 1; transform: scale(1.05); }
}
/* Enhanced Action Hints */
.enhanced-hint {
backdrop-filter: blur(12px);
background: rgba(0, 0, 0, 0.85);
border: 2px solid rgba(255, 255, 255, 0.2);
box-shadow:
0 8px 32px rgba(0, 0, 0, 0.3),
inset 0 1px 0 rgba(255, 255, 255, 0.1);
transform: scale(0.8) translateZ(0);
transition: all var(--physics-duration-normal) var(--spring-wobbly);
.hint-icon {
width: 24px;
height: 24px;
border-radius: 50%;
background: var(--gradient-physics-primary);
display: flex;
align-items: center;
justify-content: center;
&::before {
content: '';
width: 12px;
height: 12px;
background: white;
border-radius: 50%;
animation: hintPulse 2s ease-in-out infinite;
}
}
.hint-text {
font-weight: 600;
letter-spacing: 0.5px;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
&.enhanced-visible {
transform: scale(1) translateZ(var(--physics-depth));
.hint-icon::before {
animation-duration: 0.8s;
}
}
/* Direction-specific styling */
&.left-hint {
border-left-color: #ff6b6b;
.hint-icon { background: linear-gradient(135deg, #ff6b6b, #ee5a52); }
}
&.right-hint {
border-right-color: #51cf66;
.hint-icon { background: linear-gradient(135deg, #51cf66, #40c057); }
}
&.up-hint {
border-top-color: #339af0;
.hint-icon { background: linear-gradient(135deg, #339af0, #228be6); }
}
&.down-hint {
border-bottom-color: #ffb84d;
.hint-icon { background: linear-gradient(135deg, #ffb84d, #fd7e14); }
}
}
@keyframes hintPulse {
0%, 100% { transform: scale(1); opacity: 1; }
50% { transform: scale(1.3); opacity: 0.7; }
}
/* Enhanced Decision Indicators */
.enhanced-decision {
transform: translate(-50%, -50%) scale(0) rotateZ(0deg);
transition: all var(--physics-duration-normal) var(--spring-bouncy);
filter: drop-shadow(0 0 20px rgba(0, 0, 0, 0.5));
opacity: 0;
visibility: hidden;
.decision-icon {
font-size: 4rem;
animation: decisionFloat 3s ease-in-out infinite;
text-shadow: 0 0 30px currentColor;
}
.decision-particles {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
pointer-events: none;
}
.particle {
position: absolute;
width: 6px;
height: 6px;
background: currentColor;
border-radius: 50%;
opacity: 0;
animation: particleBurst 1s ease-out forwards;
@for $i from 1 through 8 {
&:nth-child(#{$i}) {
transform: rotate(#{$i * 45}deg) translateX(40px);
animation-delay: #{$i * 0.05}s;
}
}
}
&.enhanced-visible {
transform: translate(-50%, -50%) scale(1) rotateZ(360deg);
opacity: 1;
visibility: visible;
}
/* Direction-specific colors */
&.decision-left {
color: #ff6b6b;
.decision-icon { animation-duration: 2s; }
}
&.decision-right {
color: #51cf66;
.decision-icon { animation-duration: 2.5s; }
}
&.decision-up {
color: #339af0;
.decision-icon { animation-duration: 3s; }
}
&.decision-down {
color: #ffb84d;
.decision-icon { animation-duration: 2.2s; }
}
}
@keyframes decisionFloat {
0%, 100% { transform: translateY(0) scale(1); }
50% { transform: translateY(-10px) scale(1.1); }
}
@keyframes particleBurst {
0% {
opacity: 1;
transform: rotate(var(--rotation, 0deg)) translateX(0) scale(1);
}
100% {
opacity: 0;
transform: rotate(var(--rotation, 0deg)) translateX(60px) scale(0);
}
}
/* Enhanced Swipe Container */
.swipe-container {
perspective: var(--physics-perspective);
transform-style: preserve-3d;
&::before {
content: '';
position: absolute;
top: -10px;
left: -10px;
right: -10px;
bottom: -10px;
background: var(--gradient-physics-primary);
border-radius: inherit;
z-index: -1;
opacity: 0;
filter: blur(20px);
transition: opacity var(--physics-duration-slow) var(--spring-smooth);
}
}
/* Physics-based Button Enhancements */
.action-btn {
position: relative;
overflow: hidden;
transform: translateZ(0);
transition: all var(--physics-duration-normal) var(--spring-wobbly);
&::before {
content: '';
position: absolute;
top: 50%;
left: 50%;
width: 0;
height: 0;
background: rgba(255, 255, 255, 0.3);
border-radius: 50%;
transform: translate(-50%, -50%);
transition: all var(--physics-duration-fast) ease-out;
}
&:active::before {
width: 300px;
height: 300px;
}
&:hover {
transform: translateY(-8px) scale(1.05) translateZ(var(--physics-depth));
box-shadow:
0 20px 40px rgba(0, 0, 0, 0.2),
0 0 0 1px rgba(255, 255, 255, 0.1);
}
&:active {
transform: translateY(-4px) scale(0.98) translateZ(calc(var(--physics-depth) / 2));
transition-duration: var(--physics-duration-fast);
}
}
/* Enhanced Modal Animations */
.modal {
backdrop-filter: blur(15px);
&.show {
animation: modalFadeIn var(--physics-duration-slow) var(--spring-wobbly);
}
.modal-content {
transform: scale(0.8) translateY(50px) rotateX(10deg);
transition: all var(--physics-duration-slow) var(--spring-wobbly);
}
&.show .modal-content {
transform: scale(1) translateY(0) rotateX(0deg);
}
}
@keyframes modalFadeIn {
0% {
opacity: 0;
backdrop-filter: blur(0px);
}
100% {
opacity: 1;
backdrop-filter: blur(15px);
}
}
/* Enhanced Toast Notifications */
.toast {
backdrop-filter: blur(10px);
background: rgba(0, 0, 0, 0.9);
border: 1px solid rgba(255, 255, 255, 0.1);
transform: translateX(-50%) translateY(100px) scale(0.8);
transition: all var(--physics-duration-normal) var(--spring-bouncy);
&.show {
transform: translateX(-50%) translateY(0) scale(1);
}
&::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 2px;
background: var(--gradient-physics-primary);
border-radius: 50px 50px 0 0;
}
}
/* Performance Optimizations */
.enhanced-card,
.enhanced-hint,
.enhanced-decision,
.action-btn {
will-change: transform, opacity, filter;
backface-visibility: hidden;
transform-style: preserve-3d;
}
/* Mobile Optimizations */
@media (max-width: 768px) {
:root {
--physics-perspective: 800px;
--physics-depth: 50px;
--physics-duration-normal: 0.3s;
}
.enhanced-hint {
padding: 8px 16px;
font-size: 0.9rem;
.hint-icon {
width: 20px;
height: 20px;
&::before {
width: 10px;
height: 10px;
}
}
}
.enhanced-decision .decision-icon {
font-size: 3rem;
}
.particle {
width: 4px;
height: 4px;
}
}
/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
* {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
.enhanced-card::before,
.swipe-container::before {
display: none;
}
}
/* High Contrast Mode Support */
@media (prefers-contrast: high) {
.enhanced-hint {
background: rgba(0, 0, 0, 0.95);
border-width: 3px;
}
.enhanced-decision {
filter: contrast(1.5) drop-shadow(0 0 10px rgba(0, 0, 0, 0.8));
}
}
/* Print Styles */
@media print {
.enhanced-hint,
.enhanced-decision,
.physics-spinner {
display: none !important;
}
.enhanced-card {
transform: none !important;
filter: none !important;
}
}