Open In App
Related Articles

CSS cubic-bezier() Function

Improve Article
Improve
Save Article
Save
Like Article
Like

The cubic-bezier() function is an inbuilt function in CSS that is used to define a Cubic Bezier curve. 
A Bezier curve is a mathematically defined curve used in two-dimensional graphic applications like adobe illustrator, Inkscape, etc. The curve is defined by four points: the initial position and the terminating position i.e P0 and P3 respectively (which are called “anchors”) and two separate middle points i.e P1 and P2(which are called “handles”) in our example. Bezier curves are frequently used in computer graphics, animation, modeling, etc.

Syntax: 

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

Parameters: This function accepts four parameters that are mandatory. It contains a numeric value and the value of x1 and x2 lies between 0 to 1.

Example: Below program illustrates the cubic-bezier() function in CSS:

html




<!DOCTYPE html>
<html>
 
<head>
    <title>cubic-bezier function</title>
    <style>
        .geeks {
            width: 150px;
            height: 80px;
            background: green;
            transition: width 5s;
            transition-timing-function:
                cubic-bezier(0.3, 0.7, 1.0, 0.1);
        }
 
        div:hover {
            width: 300px;
        }
 
        .gfg {
            font-size: 40px;
            font-weight: bold;
            color: green;
            text-align: center;
        }
 
        h1 {
            text-align: center;
        }
    </style>
</head>
 
<body>
    <div class="gfg">GeeksforGeeks</div>
    <h1>The cubic-bezier() Function</h1>
    <div class="geeks"></div>
</body>
 
</html>


Output: 

Supported Browser:

  • Google Chrome
  • Edge
  • Firefox
  • Opera
  • Safari

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 04 Aug, 2023
Like Article
Save Article
Previous
Next
Similar Reads
Complete Tutorials