particlepy.shape
- class BaseForm(radius: float, color: Tuple[int, int, int], alpha: int = 255, angle: float = 0)[source]
Bases:
particlepy.shape.Shape,abc.ABC- The basic form class. Is used as
shapeargument inparticlepy.particle.Particle.
- Parameters
radius (float) – Radius of shape
color (Tuple[int, int, int]) – Color of shape
alpha (int, optional) – Transparency of shape (0 - 255 → RGBA), defaults to 255
angle (float, optional) – Degrees of rotation, defaults to 0
- Attributes
radius (float) – Radius of shape
_orig_radius (float) – Radius of shape when being instanced. Property is
BaseForm.orig_radius()color (List[int, int, int]) – Color of shape
_orig_color (Tuple[int, int, int]) – Color of shape when being instanced. Property is
BaseForm.orig_color()alpha (int) – Transparency of shape, ranges from 0 to 255
_orig_alpha (int) – Transparency of shape when being instanced. Property is
BaseForm.orig_alpha()angle (int) – Degrees of rotation of shape
_orig_angle (float) – Angle of shape when being instanced. Property is
BaseForm.orig_angle()surface (
pygame.Surface) – Pygame surface of shaperect (
pygame.Rect) – Pygame Rect ofsurface. Position does not affect anything
- check_size_above_zero()[source]
Checks if surface size is above null
- Returns
True if surface size above null, False if otherwise
- Return type
bool
- decrease(delta: float)[source]
Decreases radius of shape by
delta_radius- Parameters
delta (float) – Radius decrease value
- get_progress() Tuple[float, float][source]
Returns tuple of two floats: progress and inverted_progress
- Returns
progress and inverted_progress
- Return type
Tuple[float, float]
- make_shape()[source]
Creates shape for shape surface. Can be modified to make different shapes and effects.
- make_surface() pygame.Surface[source]
Makes the surface by also calling
Shape.make_shape()- Returns
Surface of shape
- Return type
pygame.Surface
- property orig_color
Returns
_orig_color- Returns
_orig_color- Return type
Tuple[int]
- property orig_radius
Returns
_orig_radius- Returns
_orig_radius- Return type
float
- The basic form class. Is used as
- class Circle(radius: float, color: Tuple[int, int, int], alpha: int = 255, angle: float = 0)[source]
Bases:
particlepy.shape.BaseForm,abc.ABCCircle shape class. Is subclass of
BaseFormand inherits all attributes and methods- Parameters
radius (float) – Radius of shape
color (Tuple[int, int, int]) – Color of shape
alpha (int, optional) – Transparency of shape (0 - 255 → RGBA), defaults to 255
angle (float, optional) – Degrees of rotation, defaults to 0
- Attributes
radius (float) – Radius of shape
_orig_radius (float) – Radius of shape when being instanced. Property is
Circle.orig_radius()color (List[int, int, int]) – Color of shape
_orig_color (Tuple[int, int, int]) – Color of shape when being instanced. Property is
Circle.orig_color()alpha (int) – Transparency of shape, ranges from 0 to 255
_orig_alpha (int) – Transparency of shape when being instanced. Property is
Circle.orig_alpha()angle (int) – Degrees of rotation of shape
_orig_angle (float) – Angle of shape when being instanced. Property is
Circle.orig_angle()surface (
pygame.Surface) – Pygame surface of shaperect (
pygame.Rect) – Pygame Rect ofsurface. Position does not affect anything
- class Image(surface: pygame.Surface, size: Tuple[int, int], alpha: int = 255, angle: float = 0)[source]
Bases:
particlepy.shape.Shape,abc.ABCImage shape class. Is subclass of
Shapeand inherits all attributes and methods and adds to it- Parameters
surface (
pygame.Surface) – Surface of shapesize (Tuple[int, int]) – Scaled size of surface
alpha (int, optional) – Transparency of shape (0 - 255 → RGBA), defaults to 255
angle (float, optional) – Degrees of rotation, defaults to 0
- Attributes
alpha (int) – Transparency of shape, ranges from 0 to 255
_orig_alpha (int) – Transparency of shape when being instanced. Property is
Image.orig_alpha()angle (int) – Degrees of rotation of shape
_orig_angle (float) – Angle of shape when being instanced. Property is
Image.orig_angle()size (List[int, int]) – Scaled size of surface
_orig_size (Tuple[int, int]) – Scaled size of surface shape when being instanced. Property is
Image.orig_size()surface (
pygame.Surface) – Pygame surface of shape_orig_surface (
pygame.Surface) – Surface of shape when being instanced. Property isImage.orig_surface()rect (
pygame.Rect) – Pygame Rect ofsurface. Position does not affect anything
- check_size_above_zero() bool[source]
Checks if surface size is above null
- Returns
True if surface size above null, False if otherwise
- Return type
bool
- get_progress() Tuple[float, float][source]
Returns
progressandinverted_progressof shape- Returns
progress,inverted_progress- Return type
Tuple[float, float]
- make_shape()[source]
Is being called by
Image.make_surface()and used to make the visual representation of the shape
- make_surface() pygame.Surface[source]
Makes the surface by also calling
Image.make_shape()- Returns
Surface of shape
- Return type
pygame.Surface
- property orig_size
Returns
_orig_size- Returns
_orig_size- Return type
Tuple[int, int]
- property orig_surface
Returns
_orig_surface- Returns
_orig_surface- Return type
Tuple[int, int]
- class Rect(radius: float, color: Tuple[int, int, int], alpha: int = 255, angle: float = 0)[source]
Bases:
particlepy.shape.BaseForm,abc.ABCRectangle shape class. Is subclass of
BaseFormand inherits all attributes and methods- Parameters
radius (float) – Radius of shape
color (Tuple[int, int, int]) – Color of shape
alpha (int, optional) – Transparency of shape (0 - 255 → RGBA), defaults to 255
angle (float, optional) – Degrees of rotation, defaults to 0
- Attributes
radius (float) – Radius of shape
_orig_radius (float) – Radius of shape when being instanced. Property is
Rect.orig_radius()color (List[int, int, int]) – Color of shape
_orig_color (Tuple[int, int, int]) – Color of shape when being instanced. Property is
Rect.orig_color()alpha (int) – Transparency of shape, ranges from 0 to 255
_orig_alpha (int) – Transparency of shape when being instanced. Property is
Rect.orig_alpha()angle (int) – Degrees of rotation of shape
_orig_angle (float) – Angle of shape when being instanced. Property is
Rect.orig_angle()surface (
pygame.Surface) – Pygame surface of shaperect (
pygame.Rect) – Pygame Rect ofsurface. Position does not affect anything
- class Shape(alpha: int = 255, angle: float = 0)[source]
Bases:
objectThis is the shape class. It is only used to subclass and use as a base for shapes.
- Parameters
alpha (int, optional) – Transparency of shape (0 - 255 → RGBA), defaults to 255
angle (float, optional) – Degrees of rotation, defaults to 0
- Attributes
alpha (int) – Transparency of shape, ranges from 0 to 255
_orig_alpha (int) – Transparency of shape when being instanced. Property is
Shape.orig_alpha()angle (float) – Degrees of rotation
_orig_angle (float) – Angle of shape when being instanced. Property is
Shape.orig_angle()
- check_size_above_zero() bool[source]
Checks if surface size is above null
- Returns
True if surface size above null, False if otherwise
- Return type
bool
- get_progress() Tuple[float, float][source]
Returns
progressandinverted_progressof shape- Returns
progress,inverted_progress- Return type
Tuple[float, float]
- make_shape()[source]
Is being called by
Shape.make_surface()and used to make the visual representation of the shape
- make_surface() pygame.Surface[source]
Makes the surface by also calling
Shape.make_shape()- Returns
Surface of shape
- Return type
pygame.Surface
- property orig_alpha
Returns original alpha
- Returns
_orig_alpha- Return type
int
- property orig_angle
Returns original angle
- Returns
_orig_angle- Return type
float
- rotate(surface: pygame.Surface, angle: float)[source]
Rotates shape by angle
Notes
Only exists because of pygame issue 2464.