Skip to content

quickstart

max edited this page Dec 10, 2022 · 1 revision

Quickstart

You can see the example in example.py file

Basic animation

from pygameAnimations import Animation as Anim
import pygame

screen = pygame.display.set_mode((800, 600))
clock = pygame.time.Clock()
anim = Anim('<path>', screen, <scale>, delay=<delay-between-updates>)

while True:
    clock.tick(60)
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            quit()

    screen.fill((0, 0, 0))
    anim.draw(<x>, <y>)
    pygame.display.flip()

Replace <path> with your path to gif file, <scale> with your scale coeficient, <delay-between-updates> with your delay between updates of animation, <x> and <y> with position of drawing the gif on the screen

Pause/Unpause

to pause animation, use:

anim.playing = Flase

to unpause:

anim.playing = True

Set frame

to set the frame, use:

anim.frame = <frame>

replace <frame> with the frame you need

Flip image

to set the static flip coeficient, use:

anim.flip = <x>, <y>

replace <x> and <y> with flip coeficient by x and y

Notes

  • When you stop animation, it automaticly returning to the first frame
  • This is Beta Version!
  • Lib supports only .gif and .png formats.

Clone this wiki locally