Matter.js Constraints
I've been trying to work out constraints in matter.js. For whatever reason I can't get them to work on my own and I can't find any examples on the internet that don't come with a heap of other code attached.
Right now I have a body that follows to the mouse so that wherever the cursor goes, it will collide with other bodies. My idea is to have the images on my website bounce out of the way a bit when I move the mouse past them. And I think this should be possible by adding a simple constraint between a body with the image on it and a static body to anchor it to the page.
all that shouldn't be too difficult if I can just get constraints to happen though 😤
https://brm.io/matter-js/demo/#constraints
2 Replies
Hey @Israel I haven't played with using matter through an entire webpage scrollable section which I think would be required to accomplish this. Is that your idea or were you thinking more for a hero section?
I've made some progress on it, I'll update here when I come to an impasse, or if I manage to figure it out
Whoops busy past couple days. Anyway, managed to get the effect I was looking for if curious:
https://israelblennerhassett.com/constraint.html
Matter.js is a rabbit hole