farbfetzen / particles Goto Github PK
View Code? Open in Web Editor NEWParticle effects in Pygame
License: MIT License
Particle effects in Pygame
License: MIT License
Rewrite the emission logic so that it does not need an increased update rate to produce smooth emission points. Instead update everything with 60 fps and if the emitter moves too fast, interpolate between current position and previous position.
current_position.lerp(previous_position) in this order.
The number of steps should be equal the number of particles to emit this frame. Or limit the number of interpolation steps? Or limit the distance between interpolation steps?
Don't use EventTimer as it spams the event queue unnecessarily. Instead create a Timer class that returns the number of events since the last update.
Remember to adjust also fire and bounce. And think about maybe extracting that logic to a base class.
to simplify some parts
Should be faster for default and bounce because all circles are identical.
When spawning a particle add the velocity of the emitter to the initial particle velocity. Calculate the emitter velocity from dt and the distance between previous position and current position.
Do this for default and bounce but maybe not for the fire?
Add option to initialize a Timer object with a certain amount of time, such that the first update already produces results. Maybe use self.time = delay - 0.000001 (one microsecond less than the desired delay). This way the emitter starts emitting immediately instead having to wait. This will be most noticeable for very low emission rates.
Also: reset the timer to the initial value (0 or that other one) when the emitter stops emitting. And only update the timer if the emitter is emitting.
instead of the custom lerp function for generating the fire particle.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.