BrianHicks / elm-particle

Simple particle system for web apps. Designed for visual flourishes like confetti.
https://package.elm-lang.org/packages/BrianHicks/elm-particle/latest/
BSD 3-Clause "New" or "Revised" License
37 stars 3 forks source link

drag slows down particles unevenly #1

Closed BrianHicks closed 5 years ago

BrianHicks commented 5 years ago

when I apply a drag calculation, particles which are traveling diagonally are slowed down less than particles which are traveling vertically and horizontally. Practically, this makes circles look like squircles!

... becomes ...

BrianHicks commented 5 years ago

looks like this might be due to applying drag to the X and Y components separately instead of to the overall velocity. https://github.com/BrianHicks/elm-particle/blob/948816bb3151e10f0b1608a4d08d62b2488f7460/src/Particle.elm#L467-L468