First, transition
CSS3 's transition function is like a butter, which makes some changes to the CSS smooth. Because native CSS transitions require more resources to be processed on the client than with JavaScript and flash, they are smoother.
Properties of the Transition
Attributes can be written separately, or can be put together to write, such as the following code, the image of the width of the height of the original is 15px, want to let it 1 seconds to transition to the width of 450px, through: hover to trigger, then the code can be as follows:
img{ height:15px;
Width:15px;
Transition: 1s 1s height ease; /* Close together */}
Or: img{ height:15px;
width : 15px;
transition-property: height;
Transition-duration1s;
transition-delay 1s;
transition-timing-function: Ease;/* attribute is written separately */}
img< Span class= "Hljs-pseudo" >:hover{height: 450px; width: 450px;}
Because the transition takes time and the transition delay is in seconds, the first time resolves to transiton-duration and the second resolves to transition-delay when the Transition property is written together. Therefore, you can give transition a shorthand method
Transiton: Transitional attribute transition requires time transition animation function transition delay time;
Attribute Details Transition-property
Not all properties can transition, only the attribute has an intermediate point value to have a transition effect. For a complete list, see this list for specific effects, see this page.
Transition-duration
Specifies the time it takes to transition from one property to another. The default value is 0, which is 0 o'clock, which indicates that the change is instantaneous and the transition effect is not visible.
Transiton-timing-function
The transition function has the following types:
Liner: Constant speed
Ease-in: Deceleration
Ease-out: Accelerating
Ease-in-out: Accelerate and decelerate first
Cubic-bezier: three times Bezier curve, can be customized click here
Triggering transitions
Simple code does not trigger any transition operation, it needs to be triggered by the user's behavior (such as click, hover, etc.), which can be triggered in the following ways:
: hoever:focus:checked media query triggers JavaScript trigger
Limitations
The advantage of transition is that it is easy to use, but it has several great limitations.
(1) Transition requires event triggering, so it can't happen automatically when the page is loaded.
(2) Transition are disposable and cannot be repeated unless triggered repeatedly.
(3) Transition can only define the start and end states, and cannot define an intermediate state, that is, there are only two states.
(4) A transition rule that defines only one property change and cannot involve multiple attributes.
CSS animation is to solve these problems and put forward.
"CSS3" transition transition