本文整理汇总了Python中animation.Animation.loadFromList方法的典型用法代码示例。如果您正苦于以下问题:Python Animation.loadFromList方法的具体用法?Python Animation.loadFromList怎么用?Python Animation.loadFromList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类animation.Animation
的用法示例。
在下文中一共展示了Animation.loadFromList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Animation
# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import loadFromList [as 别名]
size = (800, 600)
y = - size[1]
secs = 60
screen = pygame.display.set_mode(size)
tileani = Animation()
tileani.loadFromDir("noise")
tiles = []
for x in range(len(tileani.frames)):
tile = tileani.frames[x]
y = pygame.surface.Surface(size, pygame.SRCALPHA)
for y2 in range(0, math.ceil(size[1] / 240)):
for x2 in range(0, math.ceil(size[0] / 320)):
y.blit(tile, (x2*320, y2*240))
tiles.append(y)
realtileani = Animation()
realtileani.loadFromList(tiles)
redsurf = pygame.surface.Surface(size, pygame.SRCALPHA)
whitesurf = pygame.surface.Surface((200, 200))
whitesurf.fill((255, 255, 255))
for x in range(4):
redsurf.fill((255, 0, 0, 127))
rs = pygame.surfarray.array3d(redsurf)
noise_small = numpy.random.random((200, 150)) * 0.2 + 0.4
noise_big = noise_small.repeat(4, 0).repeat(4, 1)
rs = (rs.astype(noise_big.dtype) * noise_big[:, :, numpy.newaxis]).astype(rs.dtype)
redsurf = pygame.surfarray.make_surface(rs).convert_alpha()
os = pygame.surfarray.pixels_alpha(redsurf)
os[:] = 127
del rs
del os
tiles[x] = redsurf