Files
metabuilder/scss/global/_animations.scss
2026-03-09 22:30:41 +00:00

396 lines
6.8 KiB
SCSS

// ============================================
// Animation Keyframes & Utility Classes
// ============================================
// Shared animation library for all MetaBuilder frontends.
// Uses CSS custom properties (M3 tokens) instead of SCSS variables
// so this file has no project-specific dependencies.
// ============================================
// Timing defaults (CSS custom properties)
// ============================================
// These can be overridden per-project by redefining the custom properties.
:root {
--animation-duration-base: 300ms;
--animation-easing-base: cubic-bezier(0.4, 0, 0.2, 1);
--animation-easing-ease-out: ease-out;
}
// ============================================
// @keyframes Definitions
// ============================================
@keyframes fade-in {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes fade-out {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
@keyframes slide-in-up {
from {
transform: translateY(100%);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}
@keyframes slide-in-down {
from {
transform: translateY(-100%);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}
@keyframes slide-in-left {
from {
transform: translateX(-100%);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
@keyframes slide-in-right {
from {
transform: translateX(100%);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
@keyframes scale-in {
from {
transform: scale(0.95);
opacity: 0;
}
to {
transform: scale(1);
opacity: 1;
}
}
@keyframes scale-out {
from {
transform: scale(1);
opacity: 1;
}
to {
transform: scale(0.95);
opacity: 0;
}
}
@keyframes bounce {
0%, 100% {
transform: translateY(0);
animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
}
50% {
transform: translateY(-25%);
animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
}
}
@keyframes pulse {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0.5;
}
}
@keyframes ping {
0% {
transform: scale(1);
opacity: 1;
}
75%, 100% {
transform: scale(2);
opacity: 0;
}
}
@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@keyframes shimmer {
0% {
background-position: -1000px 0;
}
100% {
background-position: 1000px 0;
}
}
@keyframes shake {
0%, 100% {
transform: translateX(0);
}
10%, 30%, 50%, 70%, 90% {
transform: translateX(-10px);
}
20%, 40%, 60%, 80% {
transform: translateX(10px);
}
}
@keyframes swing {
0%, 100% {
transform: rotate(0deg);
}
20% {
transform: rotate(15deg);
}
40% {
transform: rotate(-10deg);
}
60% {
transform: rotate(5deg);
}
80% {
transform: rotate(-5deg);
}
}
@keyframes rotate-in {
from {
transform: rotate(-180deg) scale(0.8);
opacity: 0;
}
to {
transform: rotate(0deg) scale(1);
opacity: 1;
}
}
@keyframes flip {
from {
transform: perspective(400px) rotateY(90deg);
opacity: 0;
}
to {
transform: perspective(400px) rotateY(0deg);
opacity: 1;
}
}
@keyframes glow {
0%, 100% {
box-shadow: 0 0 5px color-mix(in srgb, var(--mat-sys-primary) 20%, transparent);
}
50% {
box-shadow: 0 0 20px color-mix(in srgb, var(--mat-sys-primary) 60%, transparent);
}
}
@keyframes gradient-shift {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
@keyframes float {
0%, 100% {
transform: translateY(0px);
}
50% {
transform: translateY(-20px);
}
}
@keyframes wave {
0% {
transform: rotate(0deg);
}
10% {
transform: rotate(14deg);
}
20% {
transform: rotate(-8deg);
}
30% {
transform: rotate(14deg);
}
40% {
transform: rotate(-4deg);
}
50% {
transform: rotate(10deg);
}
60% {
transform: rotate(0deg);
}
100% {
transform: rotate(0deg);
}
}
@keyframes typing {
from {
width: 0;
}
to {
width: 100%;
}
}
@keyframes blink {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0;
}
}
// ============================================
// Animation Utility Classes
// ============================================
.animate-fade-in {
animation: fade-in var(--animation-duration-base) var(--animation-easing-base) forwards;
}
.animate-fade-out {
animation: fade-out var(--animation-duration-base) var(--animation-easing-base) forwards;
}
.animate-slide-in-up {
animation: slide-in-up var(--animation-duration-base) var(--animation-easing-ease-out);
}
.animate-slide-in-down {
animation: slide-in-down var(--animation-duration-base) var(--animation-easing-ease-out);
}
.animate-slide-in-left {
animation: slide-in-left var(--animation-duration-base) var(--animation-easing-ease-out);
}
.animate-slide-in-right {
animation: slide-in-right var(--animation-duration-base) var(--animation-easing-ease-out);
}
.animate-scale-in {
animation: scale-in var(--animation-duration-base) var(--animation-easing-ease-out);
}
.animate-scale-out {
animation: scale-out var(--animation-duration-base) var(--animation-easing-ease-out);
}
.animate-bounce {
animation: bounce 1s infinite;
}
.animate-pulse {
animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
.animate-ping {
animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}
.animate-spin {
animation: spin 1s linear infinite;
}
.animate-shimmer {
animation: shimmer 2s infinite;
}
.animate-shake {
animation: shake 0.5s;
}
.animate-swing {
animation: swing 1s ease-in-out;
}
.animate-rotate-in {
animation: rotate-in var(--animation-duration-base) var(--animation-easing-ease-out);
}
.animate-flip {
animation: flip var(--animation-duration-base) var(--animation-easing-ease-out);
}
.animate-glow {
animation: glow 2s ease-in-out infinite;
}
.animate-gradient-shift {
animation: gradient-shift 3s ease infinite;
background-size: 200% 200%;
}
.animate-float {
animation: float 3s ease-in-out infinite;
}
.animate-wave {
animation: wave 2s ease-in-out;
}
.animate-typing {
animation: typing 3.5s steps(40, end);
overflow: hidden;
white-space: nowrap;
border-right: 3px solid;
animation: typing 3.5s steps(40, end), blink 0.75s step-end infinite;
}
// ============================================
// Reduced Motion
// ============================================
// Note: This is also defined in globals.scss.
// When using global.scss (via the SCSS module system),
// this block ensures reduced motion is respected
// even if globals.scss is not loaded.
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}