Skip to content

Javascript Bezier Curve Animation Library

I wrote a Javascript bezier curve animation library. I can’t seem to find any javascript bezier animation library that can handle multiple degree, so I made one myself. You can download it from the github here:

Live example

You  can see the live example here:

You can download the live example html file (or clone it from the github repository), then dissect the content inside. The usage is pretty simple, and I think it should cover most custom animation cases. I use requestAnimationFrame( ) method for a better performance (it will be paused when the tab is inactive (in the background). Beware that you might have your own animation function for your requestAnimationFrame method, if this is the case, you might have to manually modify your animation function.


  1. Import the javascript library
  2. Prepare the container tag and the child tag. (Container is where the animated DOM id located, it must have at least positioning relative/absolute, normally it should have a width and height. Child tag is the DOM id that will be animated)
  3. call ttBezier.add( options ) to ‘setup’ the bezier
  4. call ttBezier.start( name ) to start the animation with the given name
  5. call ttBezier.stop( name ) to stop the animation with the given name

That’s it, super easy. But please note that you need to provide ‘normalized’ control points. The number of points must be at least equal to degree + 1 (for example: bezier degree 3 will need 4 control points, while bezier degree 2 will need 3 control points). The 0,0 origin are the bottom left corner. While 1,1 is the top right corner. You can specify a number less than 0 and 1,meaning your animation might be outside the container box. If you’re not sure about where to put the points, you can use any online bezier drawing tool. Such as this one from

The following options are possible:

option type description
name string Animation name
containerId string Animation container DOM id
childId string Animated element DOM id
childOrigin string (optional, default ‘top-left’) Center animated element origin
degree number (optional, default 3) Bezier degree, starting from 1 (linear line)
points Array [{x: __ , y: __ }] Array of points
duration number (int milliseconds) (optional, default 500) Animation duration
easing string (optional) Easing type
loop boolean (optional, default true) Looped animation
hideOnAnimationEnd boolean (optional, default false) Hide the child when the animation ends (with display=none)
run boolean (optional, default false) Run the animation immediately


I copy-pasted some easing functions from It’s pretty straight forward, where the t is the normalized timestamp from 0 to 1. You can use it by adding an easing param. There are many easing options available, you should check it.


Child origin is when to align your animated DOM id, it has 9 possible values. The default is top-left.

  • top-left
  • top
  • top-right
  • left
  • center
  • right
  • bottom-left
  • bottom
  • bottom-right


Published inTech


  1. %%

    my blog :: bio ethanol outdoor fireplace uk (Shawn)

  2. I’ve been exploring for a bit for any high-quality articles or blog posts mesothelioma case in richland center this sort of house .
    Exploring in Yahoo I eventually stumbled upon this site.
    Studying this information So i’m satisfied to express that I have a very just right uncanny feeling I discovered
    exactly what I needed. I so much indisputably will make certain to don?t forget this website and provides it a look on a constant basis.

  3. Unquestionably believe that which you stated. Your favorite
    justification appeared to be on the internet the easiest thing to be aware of.
    I say to you, I definitely get irked while people think about worries that they just do not know about.

    You managed to hit the nail upon the top and also defined
    out the whole thing without having side-effects , people could take a signal.
    Will probably be back to get more. Thanks

    My blog post; delta 8 Gummies Wisconsin

  4. %%

    Stop by my website – 10.5 tog super king duvets (Teena)

Leave a Reply

Your email address will not be published.