top of page

Gifs (PE.gifsPG)

PE.gifsPG.Gif

animated image

 

class usage:

make an animation from list of images

Gif.__init__(self, img: list, pos=(0,0), size=(100,100), fps=12, color=(0, 0, 0, 0), rot=0)

function actions:

initialize the class 

​

parameters:

img - list of frames (list of pygame.Surface)

pos - gif position (vector2 like)

size - gif size (vector2 like)

fps - gif frames per second (int)

color - gif tint (color4 like)

rot - gif rotation (int)

​

Gif.show(self, workspace: pygame.Surface)

function actions:

put the current frame on a surface

​

parameters:

workspace - the surface to put the gif on (pygame.Surface)

​

​

recommended place in script:

in the render zone (between the frame fill and the frame update)

Gif.get_image(self)

function actions:

get current frame

​

returns:

current frame (pygame.Surface)

Gif.set_variables(self, img=None, pos=None, size=None, fps=None, color=None, rot=None)

function actions:

change the gif initial parameters without creating new or setting every parameter from scratch. None mean 'do not change'

​

parameters:

img - list of frames (list of pygame.Surface)

pos - gif position (vector2 like)

size - gif size (vector2 like)

fps - gif frames per second (int)

color - gif tint (color4 like)

rot - gif rotation (int)

PE.gifsPG.init(screen_size_)

automated function, updates global data

​

function actions:

update render resolution

​

function usage:

used by PE.init() function to update render resolution for gifs.

​

parameters:

screen_size_ - new render resolution

PE.gifsPG.fast_gif(img, workspace, pos=(0, 0), size=(100, 100), fps=12)

a gif in only one line.

​

function actions:

pick the current frame from the list, apply some transforms, and put it on a surface​

​

parameters:

img - frame list (list of pygame.Surface)

workspace - surface to put the gif on (pygame.Surface)

pos - gif position (vector2 like)

size - gif size (vector2 like)

fps - the gif's frame rate (int)

Powered and secured by Wix © 2035

bottom of page