isaacHagoel / svelte-dnd-action

An action based drag and drop container for Svelte
MIT License
1.83k stars 104 forks source link

Enhancement: Applying physics pendulum/ragdoll effect to draggable element #568

Open JohnRSim opened 6 months ago

JohnRSim commented 6 months ago

Has anyone applied physics to the draggable element - so it swings when dragged?

ie https://jsfiddle.net/gVCWE/150/ https://mrdoob.com/projects/chromeexperiments/google-gravity/ https://brm.io/matter-js/demo/#ragdoll

I've been looking at Matter-js to enable the physics but coming across a few issues.

Thanks

JohnRSim commented 6 months ago

I good example video can be seen here https://twitter.com/hernansartorio/status/1785381658578796990

isaacHagoel commented 6 months ago

It's a cool effect. you might be able to attach something to the dragged element using transformDraggedElement or by finding it in the document using a querySelector on drag start. If you're thinking about first class support (assuming there is demand and that it's not adding too much to the bundle size) - that would require modifying the library code (look at the function that decorates the dragged element in styler.js)

On Sun, May 5, 2024 at 8:21 PM John Sim @.***> wrote:

I good example video can be seen here https://twitter.com/hernansartorio/status/1785381658578796990

— Reply to this email directly, view it on GitHub https://github.com/isaacHagoel/svelte-dnd-action/issues/568#issuecomment-2094743009, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4OZC6BV3OY7AF7DHZFDH3ZAYB4FAVCNFSM6AAAAABHHSSF7SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJUG42DGMBQHE . You are receiving this because you are subscribed to this thread.Message ID: @.***>