Style animationTimingFunction attribute

Definition and usage

animationTimingFunction Specify the animation's speed curve.

Speed curves define the time it takes for an animation to change from one set of CSS styles to another.

Speed curves are used for smooth changes.

Example

Change the animationTimingFunction attribute of the <div> element:

document.getElementById("myDIV").style.animationTimingFunction = "linear";

Try it yourself

Syntax

Return the animationTimingFunction attribute:

object.style.animationTimingFunction

Set the animationTimingFunction attribute:

object.style.animationTimingFunction = "linear|ease|ease-in|ease-out|cubic-bezier(n, n, n, n)|initial|inherit"

attribute value

value description
linear The speed of the animation is the same from start to finish.
ease default value. The animation starts slowly, then speeds up, and then ends slowly.
ease-in The animation starts slowly.
ease-out The animation ends slowly.
ease-in-out The animation has a slow start and a slow end.
cubic-bezier(n, n, n, n)

Define your own values in the cubic Bezier function.

Possible values are numbers from 0 to 1.

initial Set this property to its default value. See initial.
inherit This property inherits from its parent element. See inherit.

Technical details

default value: ease
return value: string representing the element's Attribut animation-timing-function.
CSS version: CSS3

browser support

animationTimingFunction is a CSS3 (1999) feature.

All browsers fully support it:

Chrome Edge Firefox Safari Opera IE
Chrome Edge Firefox Safari Opera IE
support support support support support 11

page related

Guide CSS :Attribut animation-timing-function