pre / static /css /animations.css
yangtb24's picture
Upload 37 files
bbb6398 verified
raw
history blame contribute delete
2 kB
/* 动画与过渡效果
* 包含网站中所有动画相关样式,如展开/收起、淡入等效果
*/
/* 折叠面板动画 - 使用will-change提高性能 */
.accordion-content {
will-change: transform, opacity, max-height;
transform-origin: top;
backface-visibility: hidden;
}
.accordion-icon {
will-change: transform;
transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); /* 弹性过渡 */
}
/* 平滑展开/收起的时间函数 */
.accordion-expand {
animation-timing-function: cubic-bezier(0.17, 0.84, 0.44, 1);
}
.accordion-collapse {
animation-timing-function: cubic-bezier(0.6, 0.04, 0.98, 0.34);
}
/* 展开动画:从0高度逐渐展开到全高 */
@keyframes smoothExpand {
0% {
max-height: 0;
opacity: 0;
transform: scaleY(0.95);
}
50% {
opacity: 0.5;
}
100% {
max-height: 2000px;
opacity: 1;
transform: scaleY(1);
}
}
/* 收起动画:从全高逐渐收起到0高度 */
@keyframes smoothCollapse {
0% {
max-height: 2000px;
opacity: 1;
transform: scaleY(1);
}
30% {
opacity: 0.7;
}
100% {
max-height: 0;
opacity: 0;
transform: scaleY(0.95);
}
}
/* 淡入动画 - 用于元素出现时的平滑过渡 */
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.fade-in {
animation: fadeIn 0.15s ease-in-out;
}
/* 单次弹跳动画 - 用于吸引注意力 */
@keyframes ping-once {
0% {
transform: scale(0.95);
opacity: 0.8;
}
30% {
transform: scale(1.2);
opacity: 0.5;
}
70% {
transform: scale(0.95);
opacity: 0.3;
}
100% {
transform: scale(1);
opacity: 0;
}
}
.animate-ping-once {
animation: ping-once 0.8s cubic-bezier(0, 0, 0.2, 1) forwards;
}