ParticlePy
Examples • Documentation • PyPi
A short library for easy to use particles in Pygame based on DaFluffyPotato's particle system.
Installation
Dependencies
-
pygame
-
numpy
-
setuptools
-
Sphinx
-
sphinx_rtd_theme
Versions
Latest
Pip
pip install --upgrade particlepy
Git
git clone https://github.com/grimmigerFuchs/ParticlePy.git
cd ParticlePy/
pip install -r requirements.txt
python3 setup.py install
Usage
This is a short example of how to use this library. Examples can be found in the examples folder.
#!/usr/bin/env python3
# example.py
import pygame
import particlepy
import sys
import time
import random
pygame.init()
# pygame config
SIZE = 800, 800
screen = pygame.display.set_mode(SIZE)
pygame.display.set_caption("ParticlePy example program")
pygame.mouse.set_visible(False)
# timing
clock = pygame.time.Clock()
FPS = 60
# delta time
old_time = time.time()
delta_time = 0
# particle system to manage particles
particle_system = particlepy.particle.ParticleSystem()
# main loop
while True:
# quit window
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
pygame.quit()
sys.exit()
# delta time
now = time.time()
delta_time = now - old_time
old_time = now
# update particle properties
particle_system.update(delta_time=delta_time)
print(len(particle_system.particles))
# get mouse position
mouse_pos = pygame.mouse.get_pos()
for _ in range(5):
particle_system.emit(
particlepy.particle.Particle(shape=particlepy.shape.Rect(radius=16,
angle=random.randint(0, 360),
color=(3, 80, 111),
alpha=255),
position=mouse_pos,
velocity=(random.uniform(-150, 150), random.uniform(-150, 150)),
delta_radius=0.2))
# color manipulation
for particle in particle_system.particles:
particle.shape.color = particlepy.math.fade_color(particle=particle,
color=(83, 150, 181),
progress=particle.inverted_progress)
# render shapes
particle_system.make_shape()
# post shape creation manipulation
for particle in particle_system.particles:
particle.shape.angle += 5
# render particles
particle_system.render(surface=screen)
# update display
pygame.display.update()
screen.fill((13, 17, 23))
clock.tick(FPS)
License
Distributed under the MIT License. See LICENSE for more
information.
Contact
grimmigerFuchs - grimmigerfuchs@gmail.com
Github: https://github.com/grimmigerFuchs/ParticlePy
PyPi: https://pypi.org/project/particlepy/
Metadata
Release files for particlepy 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| particlepy-1.1.0.tar.gz | 10.6 kB | Without provenance | Details for particlepy-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| particlepy-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for particlepy-1.1.0-py3-none-any.whl |
Total release size: 19.4 kB
Release files / particlepy-1.1.0.tar.gz
| Download URL | particlepy-1.1.0.tar.gz |
|---|---|
| Size | 10.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c1fb027db49f882ece6c994044673e57c1c49409dce52ba7b3d94d9a0a25ca28
|
|
BLAKE2b-256 checksum How to use checksums |
5b3697cbb27a6752fbc856f41585efcad38a970bacdc948e707347ca7b839cd4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.6
|
Release files / particlepy-1.1.0-py3-none-any.whl
| Download URL | particlepy-1.1.0-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
96c311578bb30ce56e52321d972f84899d14f46a31d4e7d42515105718694e2b
|
|
BLAKE2b-256 checksum How to use checksums |
b21f9a04a0ba0f5330fe1a3ae3c1a9b3b1a8f1c71ca193768d97b874ce7658d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.6
|
Security for particlepy 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.