function
Cubic bezier() — CSS reference
Defines two control points between fixed endpoints (0,0) and (1,1). X coordinates must be between 0 and 1; y coordinates can exceed that range.
Formal Syntax & Structure
css syntaxcss
cubic-bezier(0.42,0,1,1)Working Example
Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>cubic-bezier()</title><style>body{margin:0}#a{padding:8px;background:rgb(232,237,241);color:rgb(0,0,0);box-sizing:border-box}#a{width:100px;height:60px;opacity:0.2;background:#2855ac;color:white;padding:0;transition:opacity 1000ms linear}#a.active{opacity:1;width:200px}#a{transition-timing-function:cubic-bezier(0.42,0,1,1)}</style><body><button id="toggle" type="button">Toggle panel</button><div id="a">Panel</div><script>const a=document.querySelector("#a");const toggle=document.querySelector("#toggle");toggle.onclick=()=>a.classList.toggle("active");function start(){getComputedStyle(a).opacity;getComputedStyle(a).width;toggle.click();getComputedStyle(a).opacity;getComputedStyle(a).width;return a.getAnimations()}async function sample(t,p="opacity"){const anim=start().find(x=>x.transitionProperty===p);if(!anim)return null;anim.pause();await anim.ready;anim.currentTime=t;return getComputedStyle(a).getPropertyValue(p)}</script></body></html>