konvajs / konva

Konva.js is an HTML5 Canvas JavaScript framework that extends the 2d context by enabling canvas interactivity for desktop and mobile applications.
http://konvajs.org/
Other
11.72k stars 934 forks source link

How to integrate ParticlesJS with KonvaJS? #865

Closed enriqueerrando closed 4 years ago

enriqueerrando commented 4 years ago

Hi,

I was wondering if there is a way to add particles to KonvaJS with ParticlesJS (or similar) or just simulate them somehow with plain Konva.

Thanks in advance!

lavrton commented 4 years ago

How do you want to use it?

As I know, ParticlesJS is drawing into the canvas element. So you can put that canvas element on top of Konva stage or under it.

Another way is to use Konva.Image add use ParticlesJS's canvas element for it. Similar to https://konvajs.org/docs/sandbox/Video_On_Canvas.html

enriqueerrando commented 4 years ago

Hehe, that's exactly what I came up with, but the ultimate idea would be to being able to add it to the main konva layer where I add all my shapes to work with that layer zindex, so u could move particles item up/down to positione it between any shapes.

Thanks!

lavrton commented 4 years ago

In that case, my last suggestion should work just fine.

enriqueerrando commented 4 years ago

Oh, sorry, I missed that last line!!

I've tried the demo but is not very smooth, maybe is just my connection. I'll try it on my project and I'll get back to u ;)

Thanks!