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 in particlepy.particle.Particle.

Is subclassed to create other shapes, e.g. Circle or Rect

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 shape

  • rect (pygame.Rect) – Pygame Rect of surface. Position does not affect anything

check_size_above_zero()[source]
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() and BaseShape.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

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

make_shape()[source]

Makes a circle

class Image(surface: pygame.Surface, size: Tuple[int, int], alpha: int = 255, angle: float = 0)[source]

Bases: particlepy.shape.Shape, abc.ABC

check_size_above_zero() → bool[source]
decrease(delta: float)[source]
get_progress() → Tuple[float, float][source]
make_shape()[source]
make_surface() → pygame.Surface[source]
property orig_size
property orig_surface
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

make_shape()[source]

Makes a rectangle

class Shape(alpha: float = 255, angle: float = 0)[source]

Bases: object

check_size_above_zero() → bool[source]
decrease(delta: float)[source]
get_progress() → Tuple[float, float][source]
make_shape()[source]
make_surface() → pygame.Surface[source]
property orig_alpha
property orig_angle
rotate(surface: pygame.Surface, angle: float)[source]

Rotates shape by angle

Notes

Only exists because of pygame issue 2464.