Page 1 of 1

Looping an image

Posted: Fri Feb 10, 2017 2:54 pm
by 2chevsky
Hello.
I want to make animated background in main menu, and i done it, but there's some glitch, when image looping from start.
i dunno how to discribe that, heh.
https://drive.google.com/file/d/0B4YvWx ... sp=sharing here's a video of glitch.
transformation:

Code: Select all

init:
    transform _moveleft(delay=0.1):
        xalign 1.0
        linear delay xalign 0.0
        repeat
main menu screen:

Code: Select all

screen main_menu: 
    
    add "images/GUI/mainmenu/bg_ground.png" at _moveleft(15)
    add "images/GUI/mainmenu/bg_hover.png"
    imagemap:
        
        hover "images/gui/hover_menu1.png"        
        ground "images/gui/ground_menu.png"
        hotspot (1175, 484, 376, 90) action Start()
        hotspot (1223, 576, 342, 62) action ShowMenu("gallery")
        hotspot (1232, 640, 310, 60) action ShowMenu("preferences_table") 
        hotspot (1298, 698, 178, 75) action ShowMenu("gallery")

        hotspot (1294, 700, 190, 79) action Quit(confirm=True)

Re: Looping an image

Posted: Fri Feb 10, 2017 3:34 pm
by gas
It's not a transform problem, it's an image issue, that's not proper drawn for that kind of cycle.

The start of the image must be totally equal to the possible final frame... AND VICEVERSA.

i've done a diagonal movement of a squared background, with steps of 256 pixels

Code: Select all

transform bganime:
    xpos 0.0
    xanchor 0.0
    ypos 0.0
    yanchor 0.0
    linear 8.0 xpos -256  ypos -256 
    repeat
...and work perfectly.

if you're sure your image is well done, try something like, using xpos instead of xalign.

Re: Looping an image

Posted: Sat Feb 11, 2017 8:25 am
by 2chevsky
Some guy from VK has give me an advice.
Transform:

Code: Select all

init:
    transform _moveleft(time=9.0):
        xanchor 1.0 xpos 1.0
        linear time xanchor .5 xpos 1.0
        repeat
and then:

Code: Select all

screen main_menu: 
    window:
        xpadding 0
        ypadding 0
        add At(HBox("images/GUI/mainmenu/bg_ground1.png", "images/GUI/mainmenu/bg_ground2.png"), _moveleft(4))
        add "images/GUI/mainmenu/bg_hover.png"