在lua中播放gif吗?

如何在 Lua 中显示“动态 GIF”的图像?我在网上搜索了很多但什么都没有找到。我正在使用 director 并尝试这段代码:

   local backgroundImage = display.newGifRect( "mainmenu.gif", 480, 320 )
   backgroundImage.x = 240; backgroundImage.y = 160
   menuGroup:insert( backgroundImage )

我认为它应该像一个图片一样,但它没有起作用。提前致谢。

原文链接 https://stackoverflow.com/questions/8921660

点赞
stackoverflow用户592511
stackoverflow用户592511

UIImageView 不支持默认的动态 gif 图像

你需要使用 UIWebView 或 glgif


编辑:(仅适用于 UIKIT)

我猜你需要使用 movieclip.newAnim() / 精灵表

local myAnim = movieclip.newAnim({ "img1.png", "img2.png", "img3.png", "img4.png" })
myAnim:play()

对于精灵,你可以使用像 Avi4Bmp 这样的工具来转换动画 gif,并查看 doc(包含示例代码)

2012-01-19 06:20:24