cubic-bezier
Introduction:
介绍:
How many times have we come across the word function? Well, it would not be wrong to say a lot. The fact that functions are used in web development while developing a website or web page is very important. There are numerous functions out there that can help you reduce the line of your codes and make your work easy and fast. Besides, if you wish to be a good coder then you must learn as many functions as you can. By learning those functions you will be able to write very efficient codes and that will also showcase your knowledge regarding web development.
我们遇到过几次单词功能? 好吧,说很多话是没有错的。 在开发网站或网页时在Web开发中使用功能这一事实非常重要。 有许多功能可以帮助您减少代码行,并使您的工作轻松快捷。 此外,如果您想成为一名优秀的编码人员,那么您必须学习尽可能多的功能。 通过学习这些功能,您将能够编写非常有效的代码,并且还将展示您对Web开发的知识。
This discussion brings us to a question: why are we talking so much about functions? Well, the answer is very clear as in this article we are going to learn about one very specific function known as cubic-bezier() function in CSS. Most of you might already know what this function is and what its behavior is and how it is helpful. But if you are not aware of this function even a bit, then this article is just for you. So, keep on reading and everything will be made clear to you about the cubic-bezier() function in CSS.
讨论给我们带来了一个问题:为什么我们这么多谈论功能? 很好,答案很明确,因为在本文中,我们将学习一个非常特定的函数,称为CSS中的cube-bezier()函数 。 你们中的大多数人可能已经知道此功能是什么,其行为是什么以及它如何有所帮助。 但是,如果您甚至根本不了解此功能,那么本文仅适合您。 因此,请继续阅读,有关CSS中的cube-bezier()函数的一切都将向您清楚。
Description:
描述:
First and foremost, let us start with the definition of the cubic-bezier function and get a gist about it.
首先,让我们从三次贝塞尔函数的定义开始,并深入了解它。
The cubic-bezier() function is used to denote a certain type of curve and that curve is known as the cubic-bezier curve. To plot this curve, it is mainly denoted by 4 points that could be P0, P1, P2 & P3. Here, the points P0 and P3 are representing the start and the end of the curve and these points will always be fixed.
cube-bezier()函数用于表示某种类型的曲线,该曲线称为三次贝塞尔曲线。 为了绘制该曲线,主要由4个点表示,可以是P0 , P1 , P2和P3 。 在这里,点P0和P3代表曲线的起点和终点,这些点将始终是固定的。
Implementation:
实现方式:
Now, that we have understood the definition of this function, let us explore further: this function is majorly used with two properties and those properties are animation-timing-function property and transition-timing-function property.
现在,我们已经了解了此功能的定义,让我们进一步探讨:该功能主要用于两个属性,而这些属性是“ 动画定时功能”属性和“ 过渡定时功能”属性。
With the help of the syntax, you will get a clear idea about the implementation of this function.
借助语法,您将对该功能的实现有一个清晰的了解。
Syntax:
句法:
element{
transition : cubic-bezier(x1,y1,x2,y2);
}
Example:
例:
<!DOCTYPE html>
<html>
<head>
<style>
.cubic-bezier {
transition: width 1.5s cubic-bezier(0.74, 0.15, 0.43, 1.5);
background: pink;
width: 180px;
height: 150px;
margin: 100px;
text-align: center;
}
.cubic-bezier:hover {
width: 70%;
}
</style>
</head>
<body>
<div class="cubic-bezier">cubic-bezier() function</div>
</body>
</html>
Output
输出量
Hover over the div in the above example to see the effect of this function.
将鼠标悬停在上面的示例中的div上可以查看此功能的效果。
Conclusion:
结论:
This was all about the cubic-bezier() function in CSS. Make sure that you use this function wisely as this function can prove to be a very good tool for styling. So, go ahead and have fun with the new learned function. Make sure that you use the above-mentioned properties while using this function on your website or web page.
这一切都与CSS中的cube-bezier()函数有关 。 确保明智地使用此功能,因为此功能可以证明是样式设计的非常好工具。 因此,继续学习新功能吧。 在网站或网页上使用此功能时,请确保使用上述属性。
翻译自: https://www.includehelp.com/code-snippets/cubic-bezier-function-with-example-in-css.aspx
cubic-bezier