
- CSS - Home
- CSS - Roadmap
- CSS - Introduction
- CSS - Syntax
- CSS - Inclusion
- CSS - Types
- CSS - Measurement Units
- CSS - Selectors
- CSS - Colors
- CSS - Backgrounds
- CSS - Fonts
- CSS - Text
- CSS - Images
- CSS - Links
- CSS - Tables
- CSS - Borders
- CSS - Border Block
- CSS - Border Inline
- CSS - Margins
- CSS - Lists
- CSS - Padding
- CSS - Cursor
- CSS - Outlines
- CSS - Dimension
- CSS - Scrollbars
- CSS - Inline Block
- CSS - Dropdowns
- CSS - Visibility
- CSS - Overflow
- CSS - Clearfix
- CSS - Float
- CSS - Arrows
- CSS - Resize
- CSS - Quotes
- CSS - Order
- CSS - Position
- CSS - Hyphens
- CSS - Hover
- CSS - Display
- CSS - Focus
- CSS - Zoom
- CSS - Translate
- CSS - Height
- CSS - Hyphenate Character
- CSS - Width
- CSS - Opacity
- CSS - Z-Index
- CSS - Bottom
- CSS - Navbar
- CSS - Overlay
- CSS - Forms
- CSS - Align
- CSS - Icons
- CSS - Image Gallery
- CSS - Comments
- CSS - Loaders
- CSS - Attr Selectors
- CSS - Combinators
- CSS - Root
- CSS - Box Model
- CSS - Counters
- CSS - Clip
- CSS - Writing Mode
- CSS - Unicode-bidi
- CSS - min-content
- CSS - All
- CSS - Inset
- CSS - Isolation
- CSS - Overscroll
- CSS - Justify Items
- CSS - Justify Self
- CSS - Tab Size
- CSS - Pointer Events
- CSS - Place Content
- CSS - Place Items
- CSS - Place Self
- CSS - Max Block Size
- CSS - Min Block Size
- CSS - Mix Blend Mode
- CSS - Max Inline Size
- CSS - Min Inline Size
- CSS - Offset
- CSS - Accent Color
- CSS - User Select
- CSS - Cascading
- CSS - Universal Selectors
- CSS - ID Selectors
- CSS - Group Selectors
- CSS - Class Selectors
- CSS - Child Selectors
- CSS - Element Selectors
- CSS - Descendant Selectors
- CSS - General Sibling Selectors
- CSS - Adjacent Sibling Selectors
- CSS Advanced
- CSS - Grid
- CSS - Grid Layout
- CSS - Flexbox
- CSS - Visibility
- CSS - Positioning
- CSS - Layers
- CSS - Pseudo Classes
- CSS - Pseudo Elements
- CSS - @ Rules
- CSS - Text Effects
- CSS - Paged Media
- CSS - Printing
- CSS - Layouts
- CSS - Validations
- CSS - Image Sprites
- CSS - Important
- CSS - Data Types
- CSS3 Advanced Features
- CSS - Rounded Corner
- CSS - Border Images
- CSS - Multi Background
- CSS - Color
- CSS - Gradients
- CSS - Box Shadow
- CSS - Box Decoration Break
- CSS - Caret Color
- CSS - Text Shadow
- CSS - Text
- CSS - 2d transform
- CSS - 3d transform
- CSS - Transition
- CSS - Animation
- CSS - Multi columns
- CSS - Box Sizing
- CSS - Tooltips
- CSS - Buttons
- CSS - Pagination
- CSS - Variables
- CSS - Media Queries
- CSS - Functions
- CSS - Math Functions
- CSS - Masking
- CSS - Shapes
- CSS - Style Images
- CSS - Specificity
- CSS - Custom Properties
- CSS Responsive
- CSS RWD - Introduction
- CSS RWD - Viewport
- CSS RWD - Grid View
- CSS RWD - Media Queries
- CSS RWD - Images
- CSS RWD - Videos
- CSS RWD - Frameworks
- CSS References
- CSS Interview Questions
- CSS Online Quiz
- CSS Online Test
- CSS Mock Test
- CSS - Quick Guide
- CSS - Cheatsheet
- CSS - Properties References
- CSS - Functions References
- CSS - Color References
- CSS - Web Browser References
- CSS - Web Safe Fonts
- CSS - Units
- CSS - Animation
- CSS Resources
- CSS - Useful Resources
- CSS - Discussion
CSS - transition-timing-function Property
CSS transition-timing-function property is used to specify the speed curve of a CSS transition. It defines how the intermediate values between the start and end of the transition are calculated.
Possible Values
<easing-function> − Each <easing-function> defines the easing function to link with the relevant property to transition, as stated in transition-property.
ease − Default value. Starts slowly, accelerates in the middle, and slows down at the end..
ease-in − Starts slowly and accelerates towards the end..
ease-out − Starts quickly and decelerates towards the end..
ease-in-out − Combines the characteristics of both ease-in and ease-out.
linear − Transitions at an even speed and is equal to cubic-bezier(0.0, 0.0, 1.0, 1.0).
step-start − Similar to steps(1, jump-start).
step-end − Similar to steps(1, jump-end).
cubic-bezier(p1, p2, p3, p4) − Allows you to define your own cubic Bezier function. The values must be between 0 and 1.
steps( n, <jumpterm>) − The transition can be divided into n stops, with each stop lasting an equal amount of time.
jump-start − Indicates a left-continuous function, representing that as the transition starts at the point where the first jump occurs.
jump-end − Indicates a right-continuous function, representing that the final jump occurs at the end of the animation.
jump-none − No jump occurs at either end. Alternatively, maintain positions at 0% and 100% marks, each for a duration of 1/n.
jump-both − Pauses at both the 0% and 100% marks add a step to the transition time.
start − Similar to a jump-start.
end − Similar to a jump-end.
Applies to
All elements, ::before and ::after pseudo-elements.
Syntax
Keyword Values
transition-timing-function: ease; transition-timing-function: ease-in; transition-timing-function: ease-out; transition-timing-function: ease-in-out; transition-timing-function: linear; transition-timing-function: step-start; transition-timing-function: step-end;
Function Values
transition-timing-function: steps(4, jump-end); transition-timing-function: cubic-bezier(0.1, 0.7, 1, 0.1);
Steps Function keywords
transition-timing-function: steps(4, jump-start); transition-timing-function: steps(10, jump-end); transition-timing-function: steps(20, jump-none); transition-timing-function: steps(5, jump-both); transition-timing-function: steps(6, start); transition-timing-function: steps(8, end);
Points to be remembered
In essence, this allows you to define an acceleration curve, which allows you to vary the speed of the transition throughout its duration.
The acceleration curve is created by defining each transitioning property with a <easing-function>.
When using multiple easing functions in CSS transitions, each function corresponds to a property specified by the transition-property, acting as a transition-property list. If easing functions are less than transition properties, the user agent repeats the list of values to calculate the appropriate values for each property. If there are more functions, it is truncated to the appropriate size. The CSS declaration remains valid in both cases.
CSS transition-timing-function - cubic-Bezier Example
The following example demonstrates the use of the transition-timing-function property with different function valuess −
<html> <head> <style> div { width: 120px; padding: 10px; transition-property: all; background-color: yellow; transition-duration: 3s; margin: 5px; } div:hover { background-color: green; padding-right: 200px; color: white; } .box1 { transition-timing-function: ease; } .box2 { transition-timing-function: ease-in; } .box3 { transition-timing-function: ease-out; } .box4 { transition-timing-function: ease-in-out; } .box5 { transition-timing-function: linear; } .box6 { transition-timing-function: cubic-bezier(0.2, -2, 0.8, 2); } </style> </head> <body> <div class="box1">ease</div> <div class="box2">ease-in</div> <div class="box3">ease-out</div> <div class="box4">ease-in-out</div> <div class="box5">linear</div> <div class="box6">cubic-bezier(0.2, -2, 0.8, 2)</div> </body> </html>
CSS transition-timing-function - steps Example
The following example demonstrates the use of the transition-timing-function property with different step-based timing functions −
<html> <head> <style> div { width: 140px; padding: 10px; transition-property: all; background-color: yellow; transition-duration: 3s; margin: 5px; } div:hover { background-color: green; padding-right: 200px; color: white; } .box1 { transition-timing-function: steps(4, jump-start); } .box2 { transition-timing-function: steps(4, jump-end); } .box3 { transition-timing-function: steps(4, jump-none); } .box4 { transition-timing-function: steps(4, jump-both); } .box5 { transition-timing-function: step-start; } .box6 { transition-timing-function: step-end; } </style> </head> <body> <div class="box1">steps(4, jump-start)</div> <div class="box2">steps(4, jump-end)</div> <div class="box3">steps(4, jump-none)</div> <div class="box4">steps(4, jump-both)</div> <div class="box5">step-start</div> <div class="box6">step-end</div> </body> </html>