css【详解】cubic-bezier()函数

简介: css【详解】cubic-bezier()函数

cubic-bezier()函数是三次方贝塞尔曲线函数。所有三次方贝塞尔曲线都是由起点、终点和两个控制点组成,在SVG或者Canvas中,三次方贝塞尔曲线的所有控制点都是不固定的。但是在CSS的cubic-bezier()函数中,起点和终点的坐标是固定的,分别是(0,0)和(1,1),因此,cubic-bezier()函数支持的

参数值只有4个,代表了两个控制点的坐标,语法如下:

cubic-bezier(x1, y1, x2, y2)

其中坐标(x1,y1)表示控制点1的坐标,坐标(x2,y2)表示控制点2的坐标。

标准的cubic-bezier()函数值的取值范围是0~1,超出1时,可以实现回弹效果

.target {
    transition: 1s cubic-bezier(.16, .67, .28, 1.46);
}
.target.run {
    transform: translateX(200px);
}

常用缓动类型的贝塞尔曲线值

:root {
    --ease-in-quad: cubic-bezier(.55, .085, .68, .53);
    --ease-in-cubic: cubic-bezier(.55, .055, .675, .19);
    --ease-in-quart: cubic-bezier(.895, .03, .685, .22);
    --ease-in-quint: cubic-bezier(.755, .05, .855, .06);
    --ease-in-expo: cubic-bezier( .95, .05, .795, .035);
    --ease-in-circ: cubic-bezier( .6, .04, .98, .335);
    --ease-out-quad: cubic-bezier( .25, .46, .45, .94);
    --ease-out-cubic: cubic-bezier( .215, .61, .355, 1);
    --ease-out-quart: cubic-bezier( .165, .84, .44, 1);
    --ease-out-quint: cubic-bezier( .23, 1, .32, 1);
    --ease-out-expo: cubic-bezier(.19, 1, .22, 1); 
    --ease-out-circ: cubic-bezier(.075, .82, .165, 1); 
    --ease-in-out-quad: cubic-bezier(.455, .03, .515, .955);
    --ease-in-out-cubic: cubic-bezier(.645, .045, .355, 1);  
    --ease-in-out-quart: cubic-bezier(.77, 0, .175, 1); 
    --ease-in-out-quint: cubic-bezier(.86, 0, .07, 1);
    --ease-in-out-expo: cubic-bezier(l, 0, 0, 1); 
    --ease-in-out-circ: cubic-bezier(.785, .135, .15, .86);
}

在线调试可使用官网

https://cubic-bezier.com/#.17,.67,.83,.67



目录
相关文章
|
3月前
|
前端开发
css【详解】steps()函数
css【详解】steps()函数
19 1
|
4月前
|
前端开发 文件存储 Python
【已解决】Flask当中render_template函数使用过程当中css文件无法正常渲染
【已解决】Flask当中render_template函数使用过程当中css文件无法正常渲染
116 1
|
5月前
|
移动开发 JavaScript 前端开发
原生JavaScript+CSS实现计算器(简单的介绍一下eval函数)
原生JavaScript+CSS实现计算器(简单的介绍一下eval函数)
56 0
|
前端开发 JavaScript
html中href和src的区别?CSS 中哪些属性可继承,哪些不可以?创建函数的几种方式?
href:href 是 Hypertext Reference 的缩写,表示超文本引用。用来建立当前元素和文档之间的链接。常用的有:link、a。
|
前端开发 数据可视化
漏刻有时数据可视化Echarts组件开发(1):报警状态组件CSS代码及封装函数
漏刻有时数据可视化Echarts组件开发(1):报警状态组件CSS代码及封装函数
55 0
|
JSON 前端开发 JavaScript
CSS样式表在javascript函数中的写法
CSS样式表在javascript函数中的写法
60 0
|
编解码 前端开发 安全
常用的css函数有哪些,你都用过吗?
css 的函数有哪些?他们都有什么作用?你认得哪些?你用过哪些?今天我就带你们一起来了解一下 css 的函数吧!
204 0
|
前端开发 安全 测试技术
深入了解 CSS 中的 :where() 和 :is() 函数
深入了解 CSS 中的 :where() 和 :is() 函数
深入了解 CSS 中的 :where() 和 :is() 函数
|
前端开发 JavaScript
css3的attr函数使用,加载unicode图标
阿里矢量图标在项目中都用使用,通常一般我们引入css使用iconfont,或者我们使用svg加载图标,亦或我们可以使用Unicode,除了第一种与第二种
221 0
css3的attr函数使用,加载unicode图标