Jump to content


I made a Codepen tool to help visualize bezier curves

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

GSAP Bezier Curve Viewer

I've been working with bezier plugin quite a bit recently and made a tool to help visualize the curves as creating them blind is no fun! At its heart it's just this function, which should work to visualize any tween (uses jQuery):

let visualizeTweenMaxBezier = (tween, steps) => {
    for (let i = 0; i < steps; i++){


	$("body").append("<div id='point" + i + "'></div>");

	    position: "absolute",
	    width: "2px",
	    height: "2px",
	    "background-color": "#7F7F7F",
	    top: tween.target.css("top"),
	    left: tween.target.css("left"),

Currently it generates code based on screen pixel values, if people are finding it useful though I might update it to generate code based on screen percentage, or percentage positions within the containing element. 


Happy coding!


See the Pen KdbqEp by looeee (@looeee) on CodePen

  • Like 1
Link to comment
Share on other sites

That is cool.  How about draggable handles and anchor points?

  • Like 1
Link to comment
Share on other sites

OK, I have changed it so that the object and the control points are draggable!

Unfortunately handles won't work here as the curves are auto-generated based on just the points. 

Link to comment
Share on other sites

I'm impressed!  The points change when the curve type is changed.  Is that because of the math?

Thanks for a great tool!

  • Like 1
Link to comment
Share on other sites

Thanks! Although actually it's simpler than that, the points are stored in different arrays and it just switches between the arrays based on the selected curve type.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.