Skip to main content

SkelForm runtime for Pygame. Uses the generic runtime

Project description

Library for running SkelForm animations in Pygame.

import skelform_pygame as skf_pg

Basic Setup

  • skf_pg.load() - loads .skf file and returns armature & textures, to be used later
  • skf_pg.animate() - transforms the armature's bones based on the animation(s)
  • skf_pg.construct() - provides the bones from this armature that are ready for use
  • skf_pg.draw() - draws the bones on-screen, with the provided style(s)

1. Load:

(armature, textures) = skf_pg.load("skellina.skf")

This should only be called once (eg; before main game loop), and armature and textures should be kept for later use.

2. Animate:

# use `skf_pg.time_frame()` to get the animation frame based on time (1000 = 1 second)
time = 2000
frame = skf_pg.time_frame(time, armature.animations[0], False, True)

print(frame) # will be at the 2 second mark of the animation

armature.bones = skf_pg.animate(armature, [armature.animations[0]], [0], [0])

Note: not needed if armature is statilc

3. Construct:

center = pygame.Vector2(screen.get_width()/2, screen.get_height()/2)

final_bones = skf_pg.construct(
    armature,
    screen,
    skf_pg.AnimOptions(
      pos=center
    )
)

Modifications to the armature (eg; aiming at cursor) may be done before or after construction.

4. Draw:

skf_pg.draw(final_bones, armature.styles, textures, screen)

Limitations

  • Mesh deformation not supported

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

skelform_pygame-0.2.2.1.tar.gz (451.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

skelform_pygame-0.2.2.1-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file skelform_pygame-0.2.2.1.tar.gz.

File metadata

  • Download URL: skelform_pygame-0.2.2.1.tar.gz
  • Upload date:
  • Size: 451.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for skelform_pygame-0.2.2.1.tar.gz
Algorithm Hash digest
SHA256 cc8b7d38de5410d10d23c3385d21747820da5312f9fb6c3d96375a9ef0bc1fab
MD5 fbf10cec811eace0aad8cd9a50408c55
BLAKE2b-256 3e0108055a7d5280c6f972715eca9af09e6c0ffa929cf312b233c19fae71f069

See more details on using hashes here.

File details

Details for the file skelform_pygame-0.2.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for skelform_pygame-0.2.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f0b384000dbb0c8edd18bce1136f8ed5b4c555a0e250f205264751dd25f2b4fa
MD5 2a36330fdafe6d4e4f4f85d6e9914564
BLAKE2b-256 e4b33049b01746a4d8209ac31b551a67b177af55c41cb84f7f7f5d6982ee2d66

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page