Jump to content
Search Community

circles don't overlapping and animate

amjad_barchini test
Moderator Tag

Recommended Posts

Hi,

 

This not a simple task and is beyond what GSAP is built for. GSAP is an animation engine but not a collision detection + physics library. GSAP can provide some aspects of this with the Physics 2D plugin:

https://gsap.com/docs/v3/Plugins/Physics2DPlugin

 

Here is how collision detection works in is simplest state:

 

But if I was you I'd look into Matter JS for this:

https://brm.io/matter-js/

 

Happy Tweening!

  • Like 1
Link to comment
Share on other sites

19 hours ago, Rodrigo said:

Hi,

 

This not a simple task and is beyond what GSAP is built for. GSAP is an animation engine but not a collision detection + physics library. GSAP can provide some aspects of this with the Physics 2D plugin:

https://gsap.com/docs/v3/Plugins/Physics2DPlugin

 

Here is how collision detection works in is simplest state:

 

But if I was you I'd look into Matter JS for this:

https://brm.io/matter-js/

 

Happy Tweening!

thank you so much but after a lot of searching I think only the three.js can build like this bubbles or vanilla javascript but it is too hard

Link to comment
Share on other sites

2 hours ago, amjad_barchini said:

thank you so much but after a lot of searching I think only the three.js can build like this bubbles or vanilla javascript but it is too hard

 

with threejs you are making it 10x harder for yourself since you will also need a physics engine with threejs like Rapier or cannon, creating it with a framework like react for example. you will need to study also extra stuff like react three fiber, react three drei, react three rapier / cannon 

 

i think Rodrigo gave you the best option here to use a physics engine directly something like this one i created with Matter it was much simpler to do it compared to trying to add physics with threejs 

 

https://balls-orcin.vercel.app/

you can grab them and test the zero gravity btn 

  • Like 1
Link to comment
Share on other sites

Yeah I totally agree with @Toso, plain canvas with matterjs seems to be the best and simplest approach, since everything is already solved for you, anything else is complicating things far too much.

 

Happy Tweening!

  • Like 1
Link to comment
Share on other sites

23 hours ago, Toso said:

 

with threejs you are making it 10x harder for yourself since you will also need a physics engine with threejs like Rapier or cannon, creating it with a framework like react for example. you will need to study also extra stuff like react three fiber, react three drei, react three rapier / cannon 

 

i think Rodrigo gave you the best option here to use a physics engine directly something like this one i created with Matter it was much simpler to do it compared to trying to add physics with threejs 

 

https://balls-orcin.vercel.app/

you can grab them and test the zero gravity btn 

thank you so much but the problem is in matter.js can I detect the size of them to occupy the whole screen ?

Link to comment
Share on other sites

2 hours ago, amjad_barchini said:

thank you so much but the problem is in matter.js can I detect the size of them to occupy the whole screen ?

That's a question for MatterJS support or maybe StackOverflow. We try to keep this forums focused on GSAP related issues.

 

Good luck with your project! 👍

Happy Tweening!

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