Home > Web Front-end > Front-end Q&A > What is the attribute word for setting animation uniform speed in css3?

What is the attribute word for setting animation uniform speed in css3?

WBOY
Release: 2022-01-24 15:50:41
Original
2701 people have browsed it

In CSS3, you can use the "animation-timing-function" attribute to set the animation to move at a constant speed. When the attribute value is set to "linear", the animation effect is specified to be at a constant speed. The syntax is "animation-timing-function: linear;".

What is the attribute word for setting animation uniform speed in css3?

The operating environment of this tutorial: Windows 10 system, CSS3&&HTML5 version, Dell G3 computer.

css3 Which attribute word is used to set the uniform speed of animation?

animation-timing-function specifies the speed curve of animation.

The speed curve defines how long it takes for the animation to change from one set of CSS styles to another.

Speed ​​curve is used to make changes smoother.

The syntax is:

animation-timing-function: value;
Copy after login

animation-timing-function Use a mathematical function called the Cubic Bezier function to generate a velocity curve. You can use your own values ​​in this function, or predefined values:

What is the attribute word for setting animation uniform speed in css3?

Examples are as follows:

<!DOCTYPE html>
<html>
<head>
<style> 
div
{
width:100px;
height:100px;
background:red;
position:relative;
animation:mymove 5s infinite;
animation-timing-function:linear;
/* Safari and Chrome */
-webkit-animation:mymove 5s infinite;
-webkit-animation-timing-function:linear;
}
@keyframes mymove
{
from {left:0px;}
to {left:200px;}
}
@-webkit-keyframes mymove /* Safari and Chrome */
{
from {left:0px;}
to {left:200px;}
}
</style>
</head>
<body>
<p><strong>注释:</strong>Internet Explorer 9 以及更早的版本不支持 animation-timing-function 属性。</p>
<div></div>
</body>
</html>
Copy after login

Output results:

What is the attribute word for setting animation uniform speed in css3?

(Learning video sharing: css video tutorial)

The above is the detailed content of What is the attribute word for setting animation uniform speed in css3?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template