Code Monkey home page Code Monkey logo

Comments (3)

gre avatar gre commented on September 19, 2024 1

There is not a single solution to this problem, bezier curve is not a bijection.

That said, it only happens when one of the handle goes out of [0,1] on the y axis.

So what you can do is simply switch x and y of the bezier parameter and I think you get the reverse function

from bezier-easing.

zikaari avatar zikaari commented on September 19, 2024 1

I also need to resolve x from y.

So what you can do is simply switch x and y of the bezier parameter and I think you get the reverse function

I tried but no luck, do I also need to invert/adjust some other parameters?

EDIT

Looked at the the code more closely - just need to swap the position of first 2 arguments and last 2 arguments to bezier function and then call the returned function with the y that you need the x for.

// resolve y
const interpolate = bezier(0.4, 0, 0.6, 1)

// resolve x
const uninterpolate =  bezier(0, 0.4, 1, 0.6)

const x = 0.25
const y = interpolate(x)

uninterpolate(y) === x  // true

from bezier-easing.

housseynCheriet avatar housseynCheriet commented on September 19, 2024

Best explanation of easing function
https://www.selectionjs.com/animation

from bezier-easing.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.