CSS Reference Property

transition-timing-function 6e3z2g

The transition-timing-function property is used to specify a timing function which defines the speed over time of an object being transitioned from one value to another. r1i5n

It describes how a transition will progress over one cycle of its duration, allowing a it to change speed during its course.

A timing function in CSS describes how intermediate values during a transition will be calculated, and are usually referred to in CSS as easing functions.

The transition-timing-function takes a timing function as a value, which is a mathematical function that specifies the speed over time of an object being transitioned from one value to another. It can also be defined using one of several predefined keywords for common timing functions.

If you define more than one transition-property property.

It is usually more convenient to specify the transition-timing-function in the transition shorthand property.

Official Syntax 2f2j3w

  • Syntax:

    transition-timing-function: <timing-function>
  • Initial: ease
  • Applies To: all elements; and ::after pseudo-elements
  • Animatable: no

Values 445h6m

<timing-function>
See the <timing-function> entry for a list of possible values, detailed explanation of each, and examples and demos for each value.

Examples 5w70f

The following specifies a hover from one background color to another using a predefined timing function keyword.

.element {
    background-color: #009966;
    transition-property: background-color;
    transition-duration: .3s;
    transition-timing-function: ease-out;
}

.element:hover {
    background-color: #0098D8;
}
                

The following are all valid transition-timing-function values:


transition-timing-function: linear;
transition-timing-function: cubic-bezier(0.42, 0, 1, 1); /* equivalent to the "ease-in" keyword */
transition-timing-function: steps(4, start); /* make transition over 4 steps */
transition-timing-function: ease-in-out;
               

See the <timing-function> entry for more values and examples.

Live Demo 603y6q

In the following demo, an element is transitioned from one position to another by transitioning its offset value, and its background color is also transitioned. Try changing the transition-timing-function value to see how the effect or “feel” of the transition changes.

View this demo on the Codrops Playground

Browser 51c73

CSS3 Transitions 5w5v64

Simple method of animating certain properties of an element, with ability to define property, duration, delay and timing function.

W3C Working Draft

ed from the following versions:

Desktop 1qa5q

  • 26
  • 16
  • 10
  • 12
  • 6.1

Mobile / Tablet 6x6t5m

  • 7.0
  • 4.4
  • No
  • 66
  • 60

* denotes prefix required.

  • ed:
  • Yes
  • No
  • Partially
  • Polyfill

Stats from caniuse.com

Further Reading 375l1b

Written by

Last updated June 11, 2020 at 10:53 pm by Mary Lou

Do you have a suggestion, question or want to contribute? Submit an issue.