Jump to content
Search Community

Dangling Question

WILDmonkeyDESIGN
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

WILDmonkeyDESIGN
Posted

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

Posted

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
Posted

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
WILDmonkeyDESIGN
Posted

thank you for the help. I ended up not using gsap and instead I am using physics.js. Thanks again. If your interested in seeing it 

See the Pen Epegxv by joshofdevelopment (@joshofdevelopment) on CodePen.

 

Posted

You may need to update and save the pen. Not seeing anything... bunch of errors about not calling done()

 

  • Like 1
WILDmonkeyDESIGN
Posted

im not getting errors but it is having problems. looks like you have to resize the window a pixel to get it to show.

Posted

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. 

 

 

WILDmonkeyDESIGN
Posted

think i fixed it. the height wasnt being set for some reason.

  • Like 2
Posted

Yep - that fixed it. Pretty neat. Thanks for sharing.

:)

 

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