CSS transition timing function refers to the way in which an element changes its CSS property values over time during a CSS transition animation. It determines the pace or speed at which the transition occurs, and controls how the element's property values change from the starting state to the ending state.
In CSS, transitions are used to create smooth animations between different states of an element, such as changing its position, size, color, opacity, or other CSS properties. The timing function is a key aspect of CSS transitions as it controls the rate of change for these properties during the animation.
CSS timing functions are defined using cubic-bezier curves, which specify the rate of change over time with four control points. The most commonly used timing functions are predefined keywords, such as "ease", "linear", "ease-in", "ease-out", and "ease-in-out", which offer different acceleration and deceleration effects during the animation.
In addition to these predefined timing functions, custom cubic-bezier curves can also be defined using specific control point values, allowing for more fine-grained control over the animation speed and easing effect.
By choosing the appropriate timing function, web designers and front-end developers can achieve different visual effects and create smooth, visually appealing animations that enhance the user experience on websites and web applications.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> /* transition-timing-function ease Linear ease-in ease-out ease-in-out */ @import url('https://fonts.googleapis.com/css2?family=Open+Sans&display=swap'); *{ margin: 0; padding: 0; } body{ background: #eaeaea; color:#373737; font-family: 'Open Sans', sans-serif; } span{ display: inline-block; margin-bottom: 20px; } .wrap{ max-width: 750px; margin: 50px auto; } .container{ padding: 15px; background-color: white; border:1px solid #aaa; margin-bottom: 15px; } .box{ background-color: tomato; height: 70px; width: 75px; transition-property: transform; transition-duration: 1.8s; transition-delay: 0.5s; } .container:hover .box{ transform: translateX(635px); } /*Constant Speed*/ .linear{ transition-timing-function: linear;} /* Start Slow End Fast */ .ease-in{ transition-timing-function: ease-in;} /* Start Fast End Slow */ .ease-out{ transition-timing-function: ease-out;} .ease-in-out{ transition-timing-function: ease-in-out;} .cubic{ transition-timing-function:cubic-bezier(0.075, 0.82, 0.165, 1);} </style> </head> <body> <div class="wrap"> <span><b>ease </b>: specifies a transition effect with a slow start, then fast, then end slowly (this is default).</span> <div class="container"> <div class="box ease"></div> </div> <span><b>linear </b>: specifies a transition effect with the same speed from start and end.</span> <div class="container"> <div class="box linear"></div> </div> <span><b>ease-in</b> : specifies a transition effect with a slow start.</span> <div class="container"> <div class="box ease-in"></div> </div> <span><b>ease-out</b> : specifies a transition effect with a slow end.</span> <div class="container"> <div class="box ease-out"></div> </div> <span><b>ease-in-out</b> : specifies a transition effect with a slow start and end.</span> <div class="container"> <div class="box ease-in-out"></div> </div> <span><b>cubic-bezier(n,n,n,n)</b> - lets you define your own values in a cubic-bezier function.</span> <div class="container"> <div class="box cubic"></div> </div> </div> </body> </html>Live Preview
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions