CSS 属性:transition-timing-function
过渡的加速和减速——外观随时间发生的渐变。
可能的值
| 值 | 描述 | 示例 |
|---|---|---|
ease | 快速加速然后缓慢减速。默认值。 | |
linear | 全程速度恒定。 | |
ease-in | 匀速加速。 | |
ease-out | 匀速减速。 | |
ease-in-out | 匀速加速然后匀速减速。 | |
cubic-bezier() | 精确的计时函数控制,指定一个 三次贝塞尔曲线。 它应该包含四个 数字 — x1, y1, x2, y2。 x1 和 x2 的值应在 0 和 1 之间。 | cubic-bezier(0.5,1.5,0.5,-0.5) |
steps() | 步进函数。过渡跳跃的区间数量(而不是如前述值那样平滑过渡)。 它应该包含一个大于零的 整数,用于指定区间数量。 可选地,它还可以包含 start 或 end 来指定值变化应该发生在区间内的哪个点(默认为 start)。 | steps(5,end) |
step-start | 等同于 steps(1, start)。 | |
step-end | 等同于 steps(1, end)。 | |
[值], [值] | 多个值可以用逗号分隔。这些值将按顺序匹配其他过渡属性(如 transition-property)中类似列出的项。 | linear, ease-in, ease-out |
inherit | ||
initial | ||
unset | ||
示例
a {
color: rgba(255,0,0,.5);
transition-property: color;
transition-duration: .3s;
transition-timing-function: linear;
}
/* A semi-transparent red link with a quick linear transition applied to the color property. */
a:hover {
color: rgba(255,0,0,1);
}
/* When hovered over, the color of the link will turn solid red at a constant speed. */
