Jump to content
Search Community

Dangling Question

WILDmonkeyDESIGN test
Moderator Tag

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

Hey all, I am trying to figure something out and I know this community is packed with amazing people.

 

I am trying to make a page that has an item hanging from the top of the page on a string. A good example of it would be a fishing line with a fish on the hook. I figured out how to move the string randomly from left to right but I cant figure out how to make the string itself move like it has a weight on it. I have been trying to find a physics engine js to solve this but everything I have found uses canvas and I dont want to use canvas. How would you either fake the physics of the string movement with gsap or what physics engine would you use for something like this?

 

much love

Link to comment
Share on other sites

A physics engine usually just calculates stuff for you. How stuff gets rendered is entirely up to you. The reason you see canvas being used is because it's very fast and has very little overhead. If you were to use SVG or HTML with a physics engine, there's a good chance that it might not run that well.

 

The simplest solution might be animating the control points on a curve. This thread is a good place to start.

 

 

 

  • Like 4
Link to comment
Share on other sites

No canvas??

 

I'm surprised @OSUblake didn't write up a 17 paragraph lecture about the awesomeness of canvas and post 29 of his demos as proof. ?

 

If you do want to see cool canvas demos, check out Blake's CodePen profile. His work is amazing and educational.

https://codepen.io/osublake/

 

Happy tweening.

:)

 

PS @WILDmonkeyDESIGN Welcome to the forum and thanks for joining Club GreenSock.

 

 

  • Haha 3
Link to comment
Share on other sites

I was showing @PointC that Coding Math has 4 videos on Verlet Integration, which is exactly what you want. 

 

This is the 4th video, which shows a weighted rope animation. It uses canvas, but feel free to substitute in whatever rendering method you like.

 

 

 

The source code for that episode.

https://github.com/bit101/CodingMath/tree/master/episode39

 

 

  • Like 5
Link to comment
Share on other sites

Yeah - there's something weird going on with that demo. I saw the same errors @Carl was seeing, but looks like they're gone now. Resizing the window does make the banana appear, but depending on the new window size, it also disappears again when you're done resizing. That's in Chrome.

 

In FF I don't see the banana at all even when I resize the window. I only see the rope.

 

In Edge I see the banana and the rope on page load, but resizing the window makes them both disappear. 

 

 

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...