{"id":22472,"date":"2013-07-19T20:16:22","date_gmt":"2013-07-20T03:16:22","guid":{"rendered":"http:\/\/css-tricks.com\/?page_id=22472"},"modified":"2013-07-19T21:05:20","modified_gmt":"2013-07-20T04:05:20","slug":"transition-timing-function","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/properties\/t\/transition-timing-function\/","title":{"rendered":"transition-timing-function"},"content":{"rendered":"
The These timing functions are commonly called easing functions<\/em>, and can be defined using a predefined keyword value, a stepping function, or a cubic B\u00e9zier curve.<\/p>\n The predefined keyword values allowed are:<\/p>\n For some values, the effect may not be as obvious unless the transition duration is set to a larger value.<\/p>\n Each of the predefined keywords has an equivalent cubic B\u00e9zier curve value or equivalent stepping function value. For example, the following two timing function values would be equivalent to each other:<\/p>\n As would the following two:<\/p>\n The To understand stepping functions, here is a demo that uses transition-timing-function<\/code> property, normally used as part of
transition<\/code> shorthand, is used to define a function that describes how a transition will proceed over its duration, allowing a transition to change speed during its course.<\/p>\n
.example {\r\n transition-timing-function: ease-out;\r\n}<\/code><\/pre>\n
\n
.example {\r\n transition-timing-function: ease-out;\r\n}\r\n\r\n.example-2 {\r\n transition-timing-function: cubic-bezier(0, 0, 0.58, 1);\r\n}<\/code><\/pre>\n
.example {\r\n transition-timing-function: step-start;\r\n}\r\n\r\n.example-2 {\r\n transition-timing-function: steps(1, start);\r\n}<\/code><\/pre>\n
Using steps() and B\u00e9zier curves<\/h2>\n
steps()<\/code> function allows you to specify intervals for the timing function. It takes one or two parameters, separated by a comma: a positive integer and an optional value of either
start<\/code> or
end<\/code>. If no second parameter is included, it will default to
end<\/code>.<\/p>\n
steps(4, start)<\/code> for the box on the left, and
steps(4, end)<\/code> for the box on the right (hover over a box or reload the frame to view the transitions):<\/p>\n
<\/code>Check out this Pen!<\/a><\/pre>\n