VincentGarreau / particles.js

A lightweight JavaScript library for creating particles
https://vincentgarreau.com/particles.js/
MIT License
29.08k stars 4.83k forks source link

Add rotation to particles ? #400

Open barberob opened 5 years ago

barberob commented 5 years ago

Hello, I wanted to know if it possible to make particles rotate on theirselves ? Not only a single rotation but I want it to rotate constantly, because when you put square and triangle, it isn't beautiful. Thanks for help.

tisaconundrum2 commented 4 years ago

square and triangle, it isn't beautiful

Are you sure about that?

barberob commented 4 years ago

What ? I didn't understand.. I meant that other shapes than circles looks "static" because they don't rotate on thereselves while moving, so I'm asking if there is a way make it rotate continually

mo-ib commented 4 years ago

I had this problem today, you can't rotate them. Normally, you could use animateTransform inside the SVG file to do this, you don't need CSS. But it looks like this plugin is overriding the SVG styles (most likely so they can set colors, borders, etc. from the config).

Maybe @VincentGarreau could consider something like this:

particles.move.rotate.enable: boolean
particles.move.rotate.speed: number | [number]
particles.move.rotate.random: boolean

For myself, I have two overlapping particle screens, one with white dots (snow) and one with snowflake SVG icons (website link) It would be really nice if I could rotate my snowflakes, because it's the one part of my UI scene that's unrealistic. If I could configure an array of speeds, or even have random speeds/directions, then it looks like my snowflakes are moving in the wind.

ericseandevlin commented 4 years ago

Have you tried using little animated gifs?

freakale commented 4 years ago

Animated GIF, APNG Tried, but did not work.

Rewrite code if possible. please https://codepen.io/freakale/pen/YzXxZEK

matteobruni commented 4 years ago

You can find this feature and many others here: https://github.com/matteobruni/tsparticles/pull/126

The config is fully compatible.