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
shape
argument 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), defaults to 255
angle (float, optional) – Degrees of rotation of shape, defaults to 0
- Attributes
radius (float) – Radius of shape
_orig_radius (float) – Radius of shape when being instanced. Property is
BaseShape.start_radius()
angle (int) – Degrees of rotation of shape
color (List[int, int, int]) – Color of shape
_orig_color (Tuple[int, int, int]) – Color of shape when being instanced. Property is
BaseShape.start_color()
alpha (int) – Transparency of shape, ranges from 0 to 255
_start_alpha (int) – Transparency of shape when being instanced. Property is
BaseShape.start_alpha()
surface (
pygame.Surface
) – Pygame surface of shaperect (
pygame.Rect
) – Pygame Rect ofsurface
. Position does not affect anything
-
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]¶ Creates shape surface and rect by calling
BaseShape.make_shape()
andBaseShape.rotate()
- Returns
Currently created shape surface (
surface
)- Return type
pygame.Surface
-
property
orig_color
¶ Returns
_start_color
- Returns
_start_color
- Return type
Tuple[int]
-
property
orig_radius
¶ Returns
_start_radius
- Returns
_start_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.ABC
Circle shape class. Is subclass of
BaseShape
and 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), defaults to 255
angle (float, optional) – Degrees of rotation of shape, defaults to 0
- Attributes
radius (float) – Radius of shape
_start_radius (float) – Radius of shape when being instanced. Property is
BaseShape.start_radius()
angle (int) – Degrees of rotation of shape
color (List[int, int, int]) – Color of shape
_start_color (Tuple[int, int, int]) – Color of shape when being instanced. Property is
BaseShape.start_color()
alpha (int) – Transparency of shape, ranges from 0 to 255
_start_alpha (int) – Transparency of shape when being instanced. Property is
BaseShape.start_alpha()
surface (
pygame.Surface
) – Pygame surface of shape
-
class
Image
(surface: pygame.Surface, size: Tuple[int, int], alpha: int = 255, angle: float = 0)[source]¶ Bases:
particlepy.shape.Shape
,abc.ABC
-
property
orig_size
¶
-
property
orig_surface
¶
-
property
-
class
Rect
(radius: float, color: Tuple[int, int, int], alpha: int = 255, angle: float = 0)[source]¶ Bases:
particlepy.shape.BaseForm
,abc.ABC
Rectangle shape class. Is subclass of
BaseShape
and 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), defaults to 255
angle (float, optional) – Degrees of rotation of shape, defaults to 0
- Attributes
radius (float) – Radius of shape
_start_radius (float) – Radius of shape when being instanced. Property is
BaseShape.start_radius()
angle (int) – Degrees of rotation of shape
color (List[int, int, int]) – Color of shape
_start_color (Tuple[int, int, int]) – Color of shape when being instanced. Property is
BaseShape.start_color()
alpha (int) – Transparency of shape, ranges from 0 to 255
_start_alpha (int) – Transparency of shape when being instanced. Property is
BaseShape.start_alpha()
surface (
pygame.Surface
) – Pygame surface of shape
-
class
Shape
(alpha: float = 255, angle: float = 0)[source]¶ Bases:
object
-
property
orig_alpha
¶
-
property
orig_angle
¶
-
property
-
rotate
(surface: pygame.Surface, angle: float)[source]¶ Rotates shape by angle
Notes
Only exists because of pygame issue 2464.