Jump to content
Search Community

Help: How can i draw a line from A point to B point

bakbuz test
Moderator Tag

Go to solution Solved by PointC,

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

  • Solution

Hi bakbuz :)

 

Welcome. That's certainly a cool website.

 

Drawing a line from a to b is not that hard, but there is a lot more going on there than just drawing a bezier curve or line. I have no idea what your current skill level may be, but creating all that behavior would be a pretty big project. It is indeed using GreenSock, but it's also using three.js for the interactive spinning globe so you'd need to take a look at that too. There really isn't an easy answer to how you'd do all that other than one small piece at a time.

 

If you're just getting started, please see the GreenSock jump start collection on CodePen

http://codepen.io/collection/ifybJ/

 

I'd recommend following Blake on CodePen

http://codepen.io/osublake/

 

Diaco is another great developer to follow:

http://codepen.io/MAW/

 

If you have specific GSAP related questions, please provide a CodePen and explanation of the problem. Here's how to do that:

http://greensock.com/forums/topic/9002-read-this-first-how-to-create-a-codepen-demo/

 

Good luck with your project and happy tweening.

:)

  • Like 5
Link to comment
Share on other sites

You need to use canvas or SVG to draw a curve like that. A quadratic Bezier curve is probably the easiest to start with since it only has 3 points.

 

Here's one made with Draggable. Same concept as following a mouse, and it's pretty easy to make.

See the Pen 2f699d9393a02e8c3a3705f9394461de?editors=0010 by osublake (@osublake) on CodePen

 

With 2 extra lines of code, we can put that center point on the curve. Now it's much easier to work with!

See the Pen 248b7efdb8606be50f2ae720344e0d84?editors=0010 by osublake (@osublake) on CodePen

  • Like 3
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.
×
×
  • Create New...