Scrolling background (not smooth)

Hi, 

I am trying to make an endless scrolling background but it seems to be jerky/not smooth. Here is some example code, I have also tried transition and translate but both have same issue. Anyone know why its not smooth?

local speed = 3

backbackground = display.newImageRect(“images/background.png”, 480, 570)

backbackground.x = display.contentWidth / 2

backbackground.y = display.contentHeight / 2

local function updateBackgrounds()

        backgroundnear.x = backgroundnear.x - (speed + 1)

end

backgroundnear = display.newImageRect(“images/newbg.png”, 1002, 280)

backgroundnear.x = display.contentWidth 

backgroundnear.y = display.contentHeight 

timer.performWithDelay(1, updateBackgrounds, -1)

Thanks

Timer is just too slow to use as a scrolling iterator; anything below 50ms is really all the same.

You should really just be doing your scrolling within an enterFrame listener instead; that way you can guarantee something happens every frame.

try this
http://j-strahan.com/main/?p=127
it was made for graphics 1.0 but could be made to work with 2.0 with a few changes. I’m in the process of completely rewriting for 2.0 should be ready in a day or two with additional features

or if you search the forum the code has been posted several times on how to do this

Thanks for the replies. enterframe still seems to be the same result tho?

jstrahan your page is down

This video demonstrates what I mean https://dl.dropboxusercontent.com/u/43113129/Screen%20Capture%20Tool_2014-02-25%2021.39.47.mov

sorry I was having trouble with the redirect and I guess the host corrected it wrong. give me your email and I’ll send to you

My email address is lukestirk@googlemail.com

Thanks

I’ll send later today when I get home. 2.0 taking a bit longer then I thought but shouldn’t be more then a few days and it will be complete

I’ve tried a few examples and all of them are jittery on Build 2013.2100

Have you tried them on a device? 

luke,

try using the enterframe event, I wouldn’t use timers… if you need some help with the code let me know… 

Vik

Timer is just too slow to use as a scrolling iterator; anything below 50ms is really all the same.

You should really just be doing your scrolling within an enterFrame listener instead; that way you can guarantee something happens every frame.

try this
http://j-strahan.com/main/?p=127
it was made for graphics 1.0 but could be made to work with 2.0 with a few changes. I’m in the process of completely rewriting for 2.0 should be ready in a day or two with additional features

or if you search the forum the code has been posted several times on how to do this

Thanks for the replies. enterframe still seems to be the same result tho?

jstrahan your page is down

This video demonstrates what I mean https://dl.dropboxusercontent.com/u/43113129/Screen%20Capture%20Tool_2014-02-25%2021.39.47.mov

sorry I was having trouble with the redirect and I guess the host corrected it wrong. give me your email and I’ll send to you

My email address is lukestirk@googlemail.com

Thanks

I’ll send later today when I get home. 2.0 taking a bit longer then I thought but shouldn’t be more then a few days and it will be complete