liabru / matter-js

a 2D rigid body physics engine for the web ▲● ■
MIT License
16.85k stars 1.97k forks source link

Is it possible to create ripple effect by using matter.js? #210

Closed chenzhutian closed 8 years ago

chenzhutian commented 8 years ago

Is it possible to create ripple effect by using matter.js? I need some ripple effect for click, but I don't want to use other physics engine. Here is an example of ripple effect. http://git.blivesta.com/rippler/

liabru commented 8 years ago

Are you talking about for UI purposes? There's nothing in matter.js for this type of thing, it's a rigid body engine. It doesn't look too difficult to just reproduce it yourself though if you'd rather not use that library?

chenzhutian commented 8 years ago

Sorry for the bad example. I mean ripple effect for animation, such as http://bl.ocks.org/mbostock/9539958, and http://jsfiddle.net/esteewhy/5ht3b/6/. As you mentioned that matter.js is not appropriate for this type of thing.

BTW, is it possible to use matter.js to simulate force direct layout, just like http://bl.ocks.org/mbostock/3231307 ?

liabru commented 8 years ago

All of these examples show very different things... Either way, there's no support for fluids like this (although I'd love to implement SPH if I had time!).

If you're just looking for a visual animations like this, rather than physical simulation, then d3, velocity.js, mo.js, GSAP etc. are good options. You could also look into CSS animations.

chenzhutian commented 8 years ago

Yes I used to use d3 to implement my animations but this time I need some physical simulation which isn't covered in d3. Anyway, thanks for your great help!