GIF/APNG not working as supposed?

-- Test

-- Use this function to perform your initial setup
function setup()
    local function s(data)
        show = true
        img = data
    end
    
    http.request("https://i.imgur.com/8VXWoDn.png", s, function(err) print(err) end)
end

-- This function gets called once every frame
function draw()
    if show then
        sprite(img, WIDTH*.5, HEIGHT*.5)
    end
end
-- Test

-- Use this function to perform your initial setup
function setup()
    local function s(data)
        show = true
        img = data
    end
    
    http.request("https://i.imgur.com/VOE4mgZ.gif", s, function(err) print(err) end)
end

-- This function gets called once every frame
function draw()
    if show then
        sprite(img, WIDTH*.5, HEIGHT*.5)
    end
end

Any ideas?

@TokOut I tried both of the code you show above and got an image for each. The gif isn’t animated because animation isn’t supported. Do a forum search for gif to see what’s been said about it.

Both should be animated, that’s what I am trying to say. Will gifs be added to codea? Like image(x, y) we could have also an image(x, y, layers, animated) :slight_smile:

PNG & GIF animations are not supported by Codea. You can write your own parser though! Last year I did began working on my own GIF-format parser, but did not finish it yet. However there is already one written in pure Lua: https://github.com/Egor-Skriptunoff/pure_lua_GIF

If you need to use a more sophisticated animation technique, you could also use bones. Spine2D is a great tool for this task. I wrote the rendering engine for Codea, so you can fully use Spine in Codea: https://codea.io/talk/discussion/8174/spine2d-support-for-codea