You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

253 lines
5.5 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/**
* 滚动触发动画系统 CSS
* 配合 GSAP ScrollTrigger 使用的动画类
* 使用方法为元素添加相应的CSS类名即可
*/
/* ===== 基础动画配置 ===== */
.scroll-animate {
/* 确保动画平滑 */
will-change: transform, opacity;
/* 硬件加速 */
transform: translateZ(0);
backface-visibility: hidden;
perspective: 1000px;
}
/* ===== Fade In Up 动画 ===== */
.fade-in-up {
opacity: 0;
transform: translateY(50px);
transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.fade-in-up.animate-active {
opacity: 1;
transform: translateY(0);
}
/* ===== Fade In Down 动画 ===== */
.fade-in-down {
opacity: 0;
transform: translateY(-50px);
transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.fade-in-down.animate-active {
opacity: 1;
transform: translateY(0);
}
/* ===== Fade In Left 动画 ===== */
.fade-in-left {
opacity: 0;
transform: translateX(-50px);
transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.fade-in-left.animate-active {
opacity: 1;
transform: translateX(0);
}
/* ===== Fade In Right 动画 ===== */
.fade-in-right {
opacity: 0;
transform: translateX(50px);
transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.fade-in-right.animate-active {
opacity: 1;
transform: translateX(0);
}
/* ===== Scale In 动画 ===== */
.scale-in {
opacity: 0;
transform: scale(0.8);
transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.scale-in.animate-active {
opacity: 1;
transform: scale(1);
}
/* ===== Rotate In 动画 ===== */
.rotate-in {
opacity: 0;
transform: rotate(-10deg) scale(0.9);
transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.rotate-in.animate-active {
opacity: 1;
transform: rotate(0deg) scale(1);
}
/* ===== 组合动画 ===== */
.fade-scale-up {
opacity: 0;
transform: translateY(30px) scale(0.95);
transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.fade-scale-up.animate-active {
opacity: 1;
transform: translateY(0) scale(1);
}
/* ===== 动画延迟类 ===== */
.animate-delay-100 { transition-delay: 0.1s; }
.animate-delay-200 { transition-delay: 0.2s; }
.animate-delay-300 { transition-delay: 0.3s; }
.animate-delay-400 { transition-delay: 0.4s; }
.animate-delay-500 { transition-delay: 0.5s; }
.animate-delay-600 { transition-delay: 0.6s; }
.animate-delay-700 { transition-delay: 0.7s; }
.animate-delay-800 { transition-delay: 0.8s; }
/* ===== 动画速度类 ===== */
.animate-fast {
transition-duration: 0.4s !important;
}
.animate-slow {
transition-duration: 1.2s !important;
}
.animate-slower {
transition-duration: 1.6s !important;
}
/* ===== 动画缓动函数类 ===== */
.animate-ease-out {
transition-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
}
.animate-ease-in-out {
transition-timing-function: cubic-bezier(0.42, 0, 0.58, 1) !important;
}
.animate-bounce {
transition-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55) !important;
}
/* ===== 特殊效果 ===== */
.blur-in {
opacity: 0;
filter: blur(10px);
transform: translateY(20px);
transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.blur-in.animate-active {
opacity: 1;
filter: blur(0px);
transform: translateY(0);
}
/* ===== 文字动画 ===== */
.text-reveal {
opacity: 0;
transform: translateY(100%);
display: inline-block;
transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.text-reveal.animate-active {
opacity: 1;
transform: translateY(0);
}
/* ===== 容器动画(用于包含多个子元素的情况) ===== */
.stagger-container .stagger-item {
opacity: 0;
transform: translateY(30px);
transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.stagger-container.animate-active .stagger-item:nth-child(1) {
transition-delay: 0.1s;
}
.stagger-container.animate-active .stagger-item:nth-child(2) {
transition-delay: 0.2s;
}
.stagger-container.animate-active .stagger-item:nth-child(3) {
transition-delay: 0.3s;
}
.stagger-container.animate-active .stagger-item:nth-child(4) {
transition-delay: 0.4s;
}
.stagger-container.animate-active .stagger-item:nth-child(5) {
transition-delay: 0.5s;
}
.stagger-container.animate-active .stagger-item {
opacity: 1;
transform: translateY(0);
}
/* ===== 响应式优化 ===== */
@media (max-width: 768px) {
.fade-in-up,
.fade-in-down,
.fade-in-left,
.fade-in-right,
.scale-in,
.rotate-in,
.fade-scale-up,
.blur-in {
/* 移动端减少动画距离 */
transform: translateY(20px);
transition-duration: 0.6s;
}
.fade-in-left {
transform: translateX(-20px);
}
.fade-in-right {
transform: translateX(20px);
}
}
/* ===== 减少动画偏好设置支持 ===== */
@media (prefers-reduced-motion: reduce) {
.fade-in-up,
.fade-in-down,
.fade-in-left,
.fade-in-right,
.scale-in,
.rotate-in,
.fade-scale-up,
.blur-in,
.text-reveal,
.stagger-item {
transition-duration: 0.01ms !important;
transition-delay: 0.01ms !important;
}
}
/* ===== 调试模式 ===== */
.scroll-animate-debug {
position: relative;
}
.scroll-animate-debug::before {
content: 'ScrollTrigger Debug';
position: absolute;
top: -20px;
left: 0;
background: rgba(255, 0, 0, 0.8);
color: white;
padding: 2px 6px;
font-size: 10px;
z-index: 9999;
pointer-events: none;
}