CSS 提供了一个 cubic-bezier()函数,
允许我们指定自定义的调速函数。它接受四个参数,分别代表两个控制锚点的坐标值:
cubic-bezier(x1, y1, x2, y2)
曲线片断的两个端点分别固定在(0,0) 和 (1,1)
前者是整个过渡的起点(时间进度为零,动画进度为零)
后者是终点(时间进度为 100%,动画进度为 100%)
@keyframes bounce {
60%, 80%, to {
transform: translateY(400px);
animation-timing-function: ease;
}
70% { transform: translateY(300px); }
90% { transform: translateY(360px); }
}
.ball {
/* 外观样式 */
animation: bounce 3s cubic-bezier(.1,.25,1,.25);
}