This commit is contained in:
张成
2025-08-25 15:24:23 +08:00
parent a993c55d3f
commit c4148d9eb6
11 changed files with 3220 additions and 2589 deletions

View File

@@ -0,0 +1,785 @@
/* 动画效果库 - 为项目添加丰富的动画效果 */
/* ===== 基础动画关键帧 ===== */
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(30px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes fadeInDown {
from {
opacity: 0;
transform: translateY(-30px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes fadeInLeft {
from {
opacity: 0;
transform: translateX(-30px);
}
to {
opacity: 1;
transform: translateX(0);
}
}
@keyframes fadeInRight {
from {
opacity: 0;
transform: translateX(30px);
}
to {
opacity: 1;
transform: translateX(0);
}
}
@keyframes slideInUp {
from {
transform: translateY(100px);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}
@keyframes slideInDown {
from {
transform: translateY(-100px);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}
@keyframes slideInLeft {
from {
transform: translateX(-100px);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
@keyframes slideInRight {
from {
transform: translateX(100px);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
@keyframes zoomIn {
from {
opacity: 0;
transform: scale(0.3);
}
50% {
opacity: 1;
}
to {
opacity: 1;
transform: scale(1);
}
}
@keyframes zoomOut {
from {
opacity: 1;
transform: scale(1);
}
50% {
opacity: 1;
}
to {
opacity: 0;
transform: scale(0.3);
}
}
@keyframes bounce {
0%, 20%, 53%, 80%, 100% {
transform: translate3d(0, 0, 0);
}
40%, 43% {
transform: translate3d(0, -30px, 0);
}
70% {
transform: translate3d(0, -15px, 0);
}
90% {
transform: translate3d(0, -4px, 0);
}
}
@keyframes pulse {
0% {
transform: scale(1);
}
50% {
transform: scale(1.05);
}
100% {
transform: scale(1);
}
}
@keyframes shake {
0%, 100% {
transform: translateX(0);
}
10%, 30%, 50%, 70%, 90% {
transform: translateX(-10px);
}
20%, 40%, 60%, 80% {
transform: translateX(10px);
}
}
@keyframes swing {
20% {
transform: rotate(15deg);
}
40% {
transform: rotate(-10deg);
}
60% {
transform: rotate(5deg);
}
80% {
transform: rotate(-5deg);
}
100% {
transform: rotate(0deg);
}
}
@keyframes rotateIn {
from {
transform: rotate(-200deg);
opacity: 0;
}
to {
transform: rotate(0);
opacity: 1;
}
}
@keyframes flipInX {
from {
transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
opacity: 0;
}
40% {
transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
}
60% {
transform: perspective(400px) rotate3d(1, 0, 0, 10deg);
}
80% {
transform: perspective(400px) rotate3d(1, 0, 0, -5deg);
}
to {
transform: perspective(400px);
opacity: 1;
}
}
@keyframes flipInY {
from {
transform: perspective(400px) rotate3d(0, 1, 0, 90deg);
opacity: 0;
}
40% {
transform: perspective(400px) rotate3d(0, 1, 0, -20deg);
}
60% {
transform: perspective(400px) rotate3d(0, 1, 0, 10deg);
}
80% {
transform: perspective(400px) rotate3d(0, 1, 0, -5deg);
}
to {
transform: perspective(400px);
opacity: 1;
}
}
@keyframes lightSpeedIn {
from {
transform: translate3d(100%, 0, 0) skewX(-30deg);
opacity: 0;
}
60% {
transform: skewX(20deg);
opacity: 1;
}
80% {
transform: skewX(-5deg);
}
to {
transform: translate3d(0, 0, 0);
opacity: 1;
}
}
@keyframes rubberBand {
from {
transform: scale(1);
}
30% {
transform: scaleX(1.25) scaleY(0.75);
}
40% {
transform: scaleX(0.75) scaleY(1.25);
}
50% {
transform: scaleX(1.15) scaleY(0.85);
}
65% {
transform: scaleX(0.95) scaleY(1.05);
}
75% {
transform: scaleX(1.05) scaleY(0.95);
}
to {
transform: scale(1);
}
}
@keyframes wobble {
from {
transform: translate3d(0, 0, 0);
}
15% {
transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg);
}
30% {
transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg);
}
45% {
transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg);
}
60% {
transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg);
}
75% {
transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg);
}
to {
transform: translate3d(0, 0, 0);
}
}
@keyframes tada {
from {
transform: scale3d(1, 1, 1);
}
10%, 20% {
transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg);
}
30%, 50%, 70%, 90% {
transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
}
40%, 60%, 80% {
transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
}
to {
transform: scale3d(1, 1, 1);
}
}
@keyframes heartBeat {
0% {
transform: scale(1);
}
14% {
transform: scale(1.3);
}
28% {
transform: scale(1);
}
42% {
transform: scale(1.3);
}
70% {
transform: scale(1);
}
}
@keyframes hinge {
0% {
transform: rotate(0);
transform-origin: top left;
animation-timing-function: ease-in-out;
}
20%, 60% {
transform: rotate(80deg);
transform-origin: top left;
animation-timing-function: ease-in-out;
}
40% {
transform: rotate(60deg);
transform-origin: top left;
animation-timing-function: ease-in-out;
}
80% {
transform: rotate(60deg) translateY(0);
transform-origin: top left;
animation-timing-function: ease-in-out;
}
100% {
transform: translateY(700px);
}
}
@keyframes rollIn {
from {
opacity: 0;
transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg);
}
to {
opacity: 1;
transform: translate3d(0, 0, 0);
}
}
@keyframes rollOut {
from {
opacity: 1;
}
to {
opacity: 0;
transform: translate3d(100%, 0, 0) rotate3d(0, 0, 1, 120deg);
}
}
/* ===== 动画类 ===== */
.animate {
animation-duration: 1s;
animation-fill-mode: both;
}
.animate.infinite {
animation-iteration-count: infinite;
}
.animate.delay-1s {
animation-delay: 1s;
}
.animate.delay-2s {
animation-delay: 2s;
}
.animate.delay-3s {
animation-delay: 3s;
}
.animate.delay-4s {
animation-delay: 4s;
}
.animate.delay-5s {
animation-delay: 5s;
}
.animate.fast {
animation-duration: 0.5s;
}
.animate.slow {
animation-duration: 2s;
}
.animate.slower {
animation-duration: 3s;
}
/* ===== 淡入动画 ===== */
.fade-in {
animation-name: fadeIn;
}
.fade-in-up {
animation-name: fadeInUp;
}
.fade-in-down {
animation-name: fadeInDown;
}
.fade-in-left {
animation-name: fadeInLeft;
}
.fade-in-right {
animation-name: fadeInRight;
}
/* ===== 滑入动画 ===== */
.slide-in-up {
animation-name: slideInUp;
}
.slide-in-down {
animation-name: slideInDown;
}
.slide-in-left {
animation-name: slideInLeft;
}
.slide-in-right {
animation-name: slideInRight;
}
/* ===== 缩放动画 ===== */
.zoom-in {
animation-name: zoomIn;
}
.zoom-out {
animation-name: zoomOut;
}
/* ===== 特殊效果动画 ===== */
.bounce {
animation-name: bounce;
}
.pulse {
animation-name: pulse;
}
.shake {
animation-name: shake;
}
.swing {
animation-name: swing;
}
.rotate-in {
animation-name: rotateIn;
}
.flip-in-x {
animation-name: flipInX;
}
.flip-in-y {
animation-name: flipInY;
}
.light-speed-in {
animation-name: lightSpeedIn;
}
.rubber-band {
animation-name: rubberBand;
}
.wobble {
animation-name: wobble;
}
.tada {
animation-name: tada;
}
.heart-beat {
animation-name: heartBeat;
}
.hinge {
animation-name: hinge;
}
.roll-in {
animation-name: rollIn;
}
.roll-out {
animation-name: rollOut;
}
/* ===== 悬停动画 ===== */
.hover-lift {
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.hover-lift:hover {
transform: translateY(-10px);
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}
.hover-scale {
transition: transform 0.3s ease;
}
.hover-scale:hover {
transform: scale(1.05);
}
.hover-rotate {
transition: transform 0.3s ease;
}
.hover-rotate:hover {
transform: rotate(5deg);
}
.hover-glow {
transition: box-shadow 0.3s ease;
}
.hover-glow:hover {
box-shadow: 0 0 20px rgba(52, 152, 219, 0.5);
}
.hover-bounce {
transition: transform 0.3s ease;
}
.hover-bounce:hover {
animation: bounce 0.6s ease;
}
/* ===== 滚动触发动画 ===== */
.scroll-animate {
opacity: 0;
transform: translateY(30px);
transition: all 0.8s ease;
}
.scroll-animate.animate-in {
opacity: 1;
transform: translateY(0);
}
/* ===== 加载动画 ===== */
.loading-spinner {
width: 40px;
height: 40px;
border: 4px solid #f3f3f3;
border-top: 4px solid #3498db;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.loading-dots {
display: inline-block;
}
.loading-dots::after {
content: '';
animation: dots 1.5s steps(5, end) infinite;
}
@keyframes dots {
0%, 20% { content: ''; }
40% { content: '.'; }
60% { content: '..'; }
80%, 100% { content: '...'; }
}
/* ===== 打字机效果 ===== */
.typewriter {
overflow: hidden;
border-right: 2px solid #333;
white-space: nowrap;
animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}
@keyframes typing {
from { width: 0; }
to { width: 100%; }
}
@keyframes blink-caret {
from, to { border-color: transparent; }
50% { border-color: #333; }
}
/* ===== 波浪效果 ===== */
.wave {
position: relative;
overflow: hidden;
}
.wave::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
animation: wave 2s infinite;
}
@keyframes wave {
0% { left: -100%; }
100% { left: 100%; }
}
/* ===== 粒子效果 ===== */
.particles {
position: relative;
}
.particle {
position: absolute;
width: 4px;
height: 4px;
background: #3498db;
border-radius: 50%;
animation: particle-float 3s infinite ease-in-out;
}
.particle:nth-child(1) { animation-delay: 0s; }
.particle:nth-child(2) { animation-delay: 0.5s; }
.particle:nth-child(3) { animation-delay: 1s; }
.particle:nth-child(4) { animation-delay: 1.5s; }
.particle:nth-child(5) { animation-delay: 2s; }
@keyframes particle-float {
0%, 100% {
transform: translateY(0) scale(1);
opacity: 1;
}
50% {
transform: translateY(-20px) scale(1.2);
opacity: 0.7;
}
}
/* ===== 3D翻转效果 ===== */
.flip-card {
perspective: 1000px;
height: 200px;
}
.flip-card-inner {
position: relative;
width: 100%;
height: 100%;
text-align: center;
transition: transform 0.8s;
transform-style: preserve-3d;
}
.flip-card:hover .flip-card-inner {
transform: rotateY(180deg);
}
.flip-card-front, .flip-card-back {
position: absolute;
width: 100%;
height: 100%;
backface-visibility: hidden;
}
.flip-card-back {
transform: rotateY(180deg);
}
/* ===== 渐变背景动画 ===== */
.gradient-bg {
background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
background-size: 400% 400%;
animation: gradient-shift 15s ease infinite;
}
@keyframes gradient-shift {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
/* ===== 霓虹灯效果 ===== */
.neon-text {
color: #fff;
text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #0073e6, 0 0 20px #0073e6, 0 0 25px #0073e6, 0 0 30px #0073e6, 0 0 35px #0073e6;
animation: neon-pulse 1.5s ease-in-out infinite alternate;
}
@keyframes neon-pulse {
from { text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #0073e6, 0 0 20px #0073e6, 0 0 25px #0073e6, 0 0 30px #0073e6, 0 0 35px #0073e6; }
to { text-shadow: 0 0 2px #fff, 0 0 4px #fff, 0 0 6px #0073e6, 0 0 8px #0073e6, 0 0 10px #0073e6, 0 0 12px #0073e6, 0 0 14px #0073e6; }
}
/* ===== 响应式动画 ===== */
@media (prefers-reduced-motion: reduce) {
.animate,
.hover-lift,
.hover-scale,
.hover-rotate,
.hover-glow,
.hover-bounce {
animation: none !important;
transition: none !important;
transform: none !important;
}
}
/* ===== 动画工具类 ===== */
.animate-on-scroll {
opacity: 0;
transform: translateY(50px);
transition: all 0.8s ease;
}
.animate-on-scroll.visible {
opacity: 1;
transform: translateY(0);
}
.animate-stagger > * {
opacity: 0;
transform: translateY(30px);
transition: all 0.6s ease;
}
.animate-stagger.visible > * {
opacity: 1;
transform: translateY(0);
}
.animate-stagger.visible > *:nth-child(1) { transition-delay: 0.1s; }
.animate-stagger.visible > *:nth-child(2) { transition-delay: 0.2s; }
.animate-stagger.visible > *:nth-child(3) { transition-delay: 0.3s; }
.animate-stagger.visible > *:nth-child(4) { transition-delay: 0.4s; }
.animate-stagger.visible > *:nth-child(5) { transition-delay: 0.5s; }
.animate-stagger.visible > *:nth-child(6) { transition-delay: 0.6s; }

File diff suppressed because it is too large Load Diff