Sprite Sequence Problem

wrote a code for playing animations, the first sequence works well (idle), but the second sequence (run) when it loops, the animation stops for a few milliseconds, and if I change the time between frames, the delay will change too

function module.animate(image, sizeX, sizeY, posX, posY, framesNum, columnNum, animtime, loop)
    local proportions = display.newImage(image)
    local width = proportions.width
    local height = proportions.height
    local widthadd = width / framesNum
    local heightadd = height / columnNum
    proportions:removeSelf()

    options = {
        frames = {},
        width = widthadd,
        height = heightadd,
        numFrames = framesNum * columnNum,
        sheetContentWidth = width,
        sheetContentHeight = height
    }

    local sequences = {}

    for i1 = 0, columnNum - 1 do
        for i2 = widthadd, width, widthadd do
            options.frames[i2 / widthadd + framesNum * i1] = {}
            options.frames[i2 / widthadd + framesNum * i1].x = i2 / widthadd * (widthadd / 2)
            options.frames[i2 / widthadd + framesNum * i1].y = height / 2 + (i1 * height)
        end

        local sequenceData = {
            name = "seq" .. tostring(i1),
            sheet = imgsheet,
            start = framesNum * i1 + 1,
            count = framesNum * i1 + framesNum,
            time = animtime,
            loopCount = loop and 0 or 1,
        }

        table.insert(sequences, sequenceData)
    end

    local imgsheet = graphics.newImageSheet(image, options)
    local sprite = display.newSprite(imgsheet, sequences)
    sprite.x = posX
    sprite.y = posY
    sprite.xScale = sizeX
    sprite.yScale = sizeY

    return sprite
end

Hi!

Sample code and image sheet used would be good for a full test, otherwise if module.animate works fine on one sequence but not another then it’s not clear whether issue lies on this function.

How about trying to manually create the run sequence instead of using module.animate to see whether you get same results as it might help to narrow down the issue?

i just changed the count in sequenceData to framesNum and it worked