What is used to define the time of transition animation in css3
In CSS3, you can use the transition-duration attribute to define the time of the transition animation. This attribute can specify the time it takes to complete the transition effect (in seconds or milliseconds). The setting syntax is "transition-duration: time;".
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
In CSS3, you can use the transition-duration attribute to define the time of the transition animation.
Transition Introduction
Transition presents a transition, a process of animation conversion, such as fade-in, fade-out, animation Wait quickly and slowly.
The transition function of CSS3 transition is more like "butter", triggering a smooth transition of styles through some simple CSS actions.
1. Transition property (transition-property) Defines the CSS property name of the transition animation
IDENT: Specified CSS property (width, height, background-color property, etc. )
all: Specify the style of all elements that support the transition-property attribute. Generally, all is used for convenience
2. The time required for transition (transition-duration) defines the transition animation The length of time
is the time it takes from setting the old properties to replacing the new properties, in seconds (s)
3. Transition animation function (transition-timing -function )
Specify the transition speed of the browser and the progress of the operation during the transition. Specify the speed of the animation by adding a function to the transition
Common transition animation |
---|
ease: speed from fast to slow (default value) |
linear : Constant speed (uniform motion) |
ease-in: The speed is getting faster and faster (gradient effect) |
ease-out: The speed is getting slower and slower (fading effect) |
ease-in-out: The speed first accelerates and then slows down (fading effect) |
4. Transition delay time (transition-delay)
Specify the time when an animation starts to execute, and how long it takes after changing the element attribute value To execute the transition effect
Positive value: The element transition effect will not be triggered immediately. It will be triggered after the set time value has passed
Negative value: The element transition effect will start to be displayed from this time point, and the previous action is truncated
0: Default value, the element transition effect is executed immediately
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>transition-property的使用</title> <style> div{ background-color: red; width: 200px; height: 200px; /*指定动画过渡的CSS属性 过渡时间 过渡动画 延迟时间*/ transition: background-color 2s ease-in-out 3s; -moz-transition: background-color 2s ease-in-out 3s; -webkit-transition: background-color 2s ease-in-out 3s; -o-transition: background-color 2s ease-in-out 3s; } div:hover{ background-color: yellow; } </style> </head> <body> <div></div> </body> </html>
Transition triggering mechanism
If there is no mouse movement effect to trigger the transition, in fact, the div will not change at all. The pseudo-class hover is a kind of triggering transition mechanism. What other triggering methods are there?
Pseudo-class triggering: :hover, :active, :focus, checked, etc.
Media query: Determine the size, direction, etc. of the device through the @media attribute.
JavaScript trigger: Trigger with JavaScript script.
The following is a summary of the steps to use transition to implement transition animation:
(1) Declare the initial state style of the element in the default style.
(2) Declare the final state style of the transition element, such as suspended state.
(3) Add some different styles by adding transition functions to the default style.
(Learning video sharing: css video tutorial, web front-end introductory tutorial)
The above is the detailed content of What is used to define the time of transition animation in css3. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



How to achieve wave effect with pure CSS3? This article will introduce to you how to use SVG and CSS animation to create wave effects. I hope it will be helpful to you!

This article will show you how to use CSS to easily realize various weird-shaped buttons that appear frequently. I hope it will be helpful to you!

Two methods: 1. Using the display attribute, just add the "display:none;" style to the element. 2. Use the position and top attributes to set the absolute positioning of the element to hide the element. Just add the "position:absolute;top:-9999px;" style to the element.

In CSS, you can use the border-image attribute to achieve a lace border. The border-image attribute can use images to create borders, that is, add a background image to the border. You only need to specify the background image as a lace style; the syntax "border-image: url (image path) offsets the image border width inward. Whether outset is repeated;".

How to create text carousel and image carousel? The first thing everyone thinks of is whether to use js. In fact, text carousel and image carousel can also be realized using pure CSS. Let’s take a look at the implementation method. I hope it will be helpful to everyone!

Implementation method: 1. Use the ":active" selector to select the state of the mouse click on the picture; 2. Use the transform attribute and scale() function to achieve the picture magnification effect, the syntax "img:active {transform: scale(x-axis magnification, y Axis magnification);}".

In CSS3, you can use the "animation-timing-function" attribute to set the animation rotation speed. This attribute is used to specify how the animation will complete a cycle and set the speed curve of the animation. The syntax is "element {animation-timing-function: speed attribute value;}".

The animation effect in css3 has deformation; you can use "animation: animation attribute @keyframes ..{..{transform: transformation attribute}}" to achieve deformation animation effect. The animation attribute is used to set the animation style, and the transform attribute is used to set the deformation style. .
