KandZ – Tuts

We like to help…!

CSS 53 💻 transitions

a - transition introduction
transitions provide a way to smoothly animate changes to CSS properties over a specified duration.
This can add interactivity and visual appeal to your web pages.
You can do this by using the transition property
transition property is shorthand for four individual transition properties:
transition-property, transition-duration, transition-timing-function, and transition-delay
use of transition: 1 - select the element you want to apply transition
2 - choose the property (color, height...) 3 - specify the duration of the transition (1s, 2s...)
4 - specify the timing function (linear, ease...) 5 - specify the starting delay

b - transition property
transition property is a powerful tool for creating smooth animations between different states of an element
syntax: transition: [ property || duration || timing-function || delay ] [, ...]
you can use: - property and duration only - property, duration and delay
property, duration and timing-function - property, duration, timing-function and delay
you can also use multiple properties separated by ',' and even all keyword
transition: background-color 0.5s ease, transform 0.3s ease; → Transition properties
transform: scale(1.2); → end state: Scale the box up by 20% on hover

c - transition timing functions
CSS provides several timing functions that you can use to control the speed curve of a transition
ease: Default value. Starts slow, speeds up, and then slows down again.
linear: Constant speed from start to finish.
ease-in: Starts slowly and then accelerates.
ease-out: Starts quickly and then slows down.
ease-in-out: Starts slowly, accelerates in the middle, and then slows down again at the end.
You can also define custom timing functions using cubic-bezier values.
A common example is cubic-bezier(0, 1, 1, 0)

Leave a Reply