Transition-timing-function - Property CSS

transition-timing-function

Summary of characteristics of the transition-timing-function property

Quick description
A property that defines the easing function to be used during a transition.
Status
Standard
Applies to
All elements.
Usable for
HTML
Predefined values
ease | ease-in | ease-out | ease-in-out | linear | steps() | cubic-bezier()
Percentages
Not applicable.
Initial value
ease
Inherited by default
No.
Not animable: the transition-timing-function property cannot be animated.
Per grammar: serialization in the order of syntax.
W3C Module
CSS Transitions
 🡇  
 🡅  
Document status: WD (Working Draft)

Document status: WD (Working Draft)

Syntax diagram of transition-timing-function.

transition-timing-function - Syntax DiagramSyntax diagram of the transition-timing-function CSS property. linear linear ease ease ease-in ease-in ease-out ease-out ease-in-out ease-in-out steps() steps() cubic-bezier() cubic-bezier()transition-timing-function:;transition-timing-function:;
Syntax diagram of the transition-timing-function property.
The links in the diagram provide more details about the values.

Description of the transition-timing-function property.

transition-timing-function defines an acceleration function to calculate the dynamics of the transition. Is the progression linear? Is there slowing down or speeding up? etc.

Reminder: a transition consists of gradually changing the value of a property. For a general explanation about transitions, refer to the shorthand property transition.

Values for transition-timing-function.

  • transition-timing-function: ease-in;

    The different acceleration functions are described below. They are the same as those of the animation-timing-function property.

    Value
    Timing function linear
    Time
    linear
    The value varies at a uniform speed throughout the entire duration of the transition.
    Value
    Timing function linear
    Time
    linear()
    The value evolves following a series of straight line segments.
    Value
    Timing function ease
    Time
    ease
    The variation of the value is slightly slowed at the beginning, and strongly slowed at the end.
    Value
    Timing function ease-in
    Time
    ease-in
    The variation of the value slows down at the beginning, then continues at a uniform speed.
    Value
    Timing function ease-out
    Time
    ease-out
    The variation of the value starts with a constant speed, then slows down towards the end.
    Value
    Timing function ease-in-out
    Time
    ease-in-out
    The variation of the value experiences a slowdown at the beginning and at the end.
    Value
    Timing function step()
    Time
    steps(5)
    The variation of the value does not happen in jumps. The number of steps is the parameter of the function steps() .
    Value
    Timing function cubic-bezier()
    Time
    cubic-bezier()
    The variation of the value follows a law defined by the four parameters of the function cubic-bezier().
  • transition-timing-function: ease-in, linear;

    When several values are specified, separated by commas, they apply to the different transitions defined by the property transition-property. See the explanations on the page on multiple transitions.

  • transition-timing-function: initial; (ease) transition-timing-function: inherit; transition-timing-function: revert; transition-timing-function: revertLayer; transition-timing-function: unset;

    Links to the presentation of these values: initial, inherit, revert, revert-layer, unset.

Animation of the transition-timing-function property.

The animation of the property transition-timing-function is not possible.

Manipulating the transition-timing-function property programmatically.

With Javascript, change the value of transition-timing-function.

In JavaScript, here is how to modify the value of transition-timing-function. There are two possible codes in JavaScript because this language accepts the property name written in kebab-case, typical of CSS, and in camel-case.

Javascript
let el = document.getElementById('id'); el.style['transition-timing-function'] = 'ease-in-out'; // or let el = document.getElementById('id'); el.style.transitionTimingFunction = 'ease-in-out';

With Javascript, read the value of transition-timing-function.

This code retrieves the value of the property when it has been directly assigned to the element itself by the style attribute, and not through a CSS selector.

Javascript
let el = document.getElementById('id'); let value = el.style['transition-timing-function']; // or let el = document.getElementById('id'); let value = el.style.transitionTimingFunction;

With Javascript, read the computed value of transition-timing-function.

The computed value is the one that results from the evaluation of the inheritance cascade, or, failing that, it will be the initial value of the property (ease in the case of transition-timing-function).

Javascript
let el = document.getElementById('id'); let value = window.getComputedStyle(el).getPropertyValue('transition-timing-function');

With JQuery, change the value of transition-timing-function.

JQuery

$('#id').css('transition-timing-function', 'ease-in-out');
// or
$('#id').css('transitionTimingFunction', 'ease-in-out');

With JQuery, read the computed value of transition-timing-function.

JQuery
let value = $('#id').css('transition-timing-function');

Other examples of code.

Other examples of Javascript and JQuery code interacting with CSS are given on the page Javascript and CSS.

Try it yourself.

The buttons below apply the entered value to the property transition-timing-function and then display either the value as it was applied, or the computed value. This second option allows seeing how the value of the property is stored (serialized), but in the case of transition-timing-function, there is no difference between the applied value and the computed value.

Simulator.

Choose a value for the property transition-timing-function and click the 'Start transition' button. The second element follows a linear transition, for comparison.

transition-timing-function :

Linear
(for comparison)

Browsers compatibility with transition-timing-function.

Acceleration functions have been well supported by all browsers for quite a few years. There is no compatibility issue to consider for the property transition-timing-function.

Column 1
General support for transitions.
Column 2
Support by browsers for the transition-timing-function property which defines the acceleration function of the transition.
1
Transitions
support
2
transition-timing-function
property
Estimated overall support.
97%
96%

Browsers on computers :

Mobile browsers :

Outdated or marginal browsers :

Internet Explorer

QQ Browser

Safari sur IOS

Firefox pour Androïd

Opéra Mobile

Baidu Browser

KaiOS Browser

UC Browser pour Androïd

Samsung Internet

Chrome

Edge

Firefox

Androïd Brower

Chrome pour Androïd

Opéra

Safari

Opéra mini

Historic of the transition-timing-function property.

  • CSS Transitions - Level 1

    Normally, when a property changes of value, its display on the screen is immediate. This specification module describes how to progressively change properties from one value to another over a given time. In other words, how to gradually move from one state to another.
    However, an external event is needed to trigger the change in property values (JavaScript code, user action, etc.). In this sense, transitions differ from animations, which can run independently of any external action.

    Regarding transition-timing-function.
    WD
    March 20, 2009
    Working Draft.
    CR
    PR
    REC
  • CSS Easing Functions Level 1

    Regarding transition-timing-function. Description of the different movement dynamics applicable to transitions.
    WD
    February 21, 2017
    Working Draft.
    CR
    April 30, 2019
    Candidate Recommendation.
    PR
    REC
  • CSS Transitions - Level 2

    Level 2 of the specification on transitions adds the ability to apply a transition to a discrete property.
    A new at-rule @starting-style allows defining the starting values for property values. It is now possible to apply a transition to elements that go from the invisible state to the visible state.

    Regarding transition-timing-function. No change to the transition-timing-function property.
    WD
    September 05, 2023
    Working Draft.
    CR
    PR
    REC
  • CSS Easing Functions Level 2

    Regarding transition-timing-function. No change regarding movement dynamics.
    WD
    August 29, 2024
    Working Draft.
    CR
    PR
    REC

See also : the transitions.

The W3C publishes the specifications in the form of modules. Transitions are described in the module CSS Transitions, as well as the other properties listed below.

Properties:

transition
Group the different parameters of one or more transitions.
transition-behavior
Defines the behavior of transitions on properties whose animation type is discrete.
transition-delay
Sets the amount of time to wait before the transition begins, counted from the time the property is changed.
transition-duration
Defines the duration of a transition, i.e. the time it takes to complete its transition.
transition-property
Defines the property(s) on which a transition should be applied.
Transition-timing-function
A property that defines the easing function to be used during a transition.

At-rules:

@starting-style
Sets the initial values for properties that will be subject to a transition.