HTML Dog
跳至导航

CSS 属性:transition-timing-function

过渡的加速和减速——外观随时间发生的渐变。

可能的值

描述示例
ease快速加速然后缓慢减速。默认值。
linear全程速度恒定。
ease-in匀速加速。
ease-out匀速减速。
ease-in-out匀速加速然后匀速减速。
cubic-bezier()精确的计时函数控制,指定一个 三次贝塞尔曲线
它应该包含四个 数字 — x1, y1, x2, y2。
x1 和 x2 的值应在 01 之间。
cubic-bezier(0.5,1.5,0.5,-0.5)
steps()步进函数。过渡跳跃的区间数量(而不是如前述值那样平滑过渡)。
它应该包含一个大于零的 整数,用于指定区间数量。
可选地,它还可以包含 startend 来指定值变化应该发生在区间内的哪个点(默认为 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.  */

浏览器支持

css-transitions 支持情况? 来自 caniuse.com 的关于 css-transitions 功能在各大浏览器中支持情况的数据。