Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8288777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:20:44+00:00 2026-06-08T12:20:44+00:00

In CSS3 transitions, you can specify a timing function as ‘cubic-bezier:(0.25, 0.3, 0.8, 1.0)’

  • 0

In CSS3 transitions, you can specify a timing function as ‘cubic-bezier:(0.25, 0.3, 0.8, 1.0)’
In that string, you are only specifying the XY for points P1 and P2 along the curve, as P0 and P3 are always (0.0, 0.0), and (1.0, 1.0) respectively.

According to Apple’s site:
x [is] expressed as a fraction of the overall duration and y expressed as a fraction of the overall change

My question is how can this be mapped back to a traditional 1 dimensional T value in javascript?

—

From Apple docs on animating with transitions
enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T12:20:45+00:00Added an answer on June 8, 2026 at 12:20 pm

    Browsing through webkit-source a bit, the following code will give the correct T value for the implicit curve used in CSS3 transitions:

    Visual demo (codepen.io)

    Hope this helps someone!

    function loop(){
        var t = (now - animationStartTime) / ( animationDuration*1000 );
    
        var curve = new UnitBezier(Bx, By, Cx, Cy);
        var t1 = curve.solve(t, UnitBezier.prototype.epsilon);
        var s1 = 1.0-t1;
    
        // Lerp using solved T
        var finalPosition.x = (startPosition.x * s1) + (endPosition.x * t1);
        var finalPosition.y = (startPosition.y * s1) + (endPosition.y * t1);
    }
    
    
    /**
    * Solver for cubic bezier curve with implicit control points at (0,0) and (1.0, 1.0)
    */
    function UnitBezier(p1x, p1y, p2x, p2y) {
        // pre-calculate the polynomial coefficients
        // First and last control points are implied to be (0,0) and (1.0, 1.0)
        this.cx = 3.0 * p1x;
        this.bx = 3.0 * (p2x - p1x) - this.cx;
        this.ax = 1.0 - this.cx -this.bx;
    
        this.cy = 3.0 * p1y;
        this.by = 3.0 * (p2y - p1y) - this.cy;
        this.ay = 1.0 - this.cy - this.by;
    }
    
    UnitBezier.prototype.epsilon = 1e-6; // Precision  
    UnitBezier.prototype.sampleCurveX = function(t) {
        return ((this.ax * t + this.bx) * t + this.cx) * t;
    }
    UnitBezier.prototype.sampleCurveY = function (t) {
        return ((this.ay * t + this.by) * t + this.cy) * t;
    }
    UnitBezier.prototype.sampleCurveDerivativeX = function (t) {
        return (3.0 * this.ax * t + 2.0 * this.bx) * t + this.cx;
    }
    
    
    UnitBezier.prototype.solveCurveX = function (x, epsilon) {
        var t0; 
        var t1;
        var t2;
        var x2;
        var d2;
        var i;
    
        // First try a few iterations of Newton's method -- normally very fast.
        for (t2 = x, i = 0; i < 8; i++) {
            x2 = this.sampleCurveX(t2) - x;
            if (Math.abs (x2) < epsilon)
                return t2;
            d2 = this.sampleCurveDerivativeX(t2);
            if (Math.abs(d2) < epsilon)
                break;
            t2 = t2 - x2 / d2;
        }
    
        // No solution found - use bi-section
        t0 = 0.0;
        t1 = 1.0;
        t2 = x;
    
        if (t2 < t0) return t0;
        if (t2 > t1) return t1;
    
        while (t0 < t1) {
            x2 = this.sampleCurveX(t2);
            if (Math.abs(x2 - x) < epsilon)
                return t2;
            if (x > x2) t0 = t2;
            else t1 = t2;
    
            t2 = (t1 - t0) * .5 + t0;
        }
    
        // Give up
        return t2;
    }
    
    // Find new T as a function of Y along curve X
    UnitBezier.prototype.solve = function (x, epsilon) {
        return this.sampleCurveY( this.solveCurveX(x, epsilon) );
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a customized show/hide toggle script that I'm using along with CSS3 transitions
I've just been experimenting with a CSS tooltip that fades in with CSS3's transitions.
i have a problem using css3 transitions how can i make the transition smooth
I have a navigation menu that has links with CSS3 transitions with a speed
How can I make a CSS3 slideshow, with fade transitions, which would be timed?
I've started playing around with CSS3 transitions in one of my projects, and I
I was playing around with the new CSS3 transitions and I seem to have
I'm trying to get my head wrapped around CSS3 transitions, and I'm not sure
I'm trying to wrap my head around CSS3 when it comes to transitions and
I'm just getting into CSS3 transitions (about time!) and I witness some strange behavior

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.