Making image change loop infinitely

Guys, how do you make a series of images changing and looping?

Eg:
Image1 comes out, after 5 seconds change into Image2, then after another 5 seconds it will change into Image3 and then after another 5 seconds it will change back to Image1 and I want to make this looping.

I tried to use timer but failed. After Image3, it won't change into Image1 and stays at Image3. I want to make an advertisement like banner.

Can somebody give me a hand here?

Best Answers

Answers

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited October 2014

    Create a text attribute called self.imagePrefix and set its value to "Image" (without the quotes). Create an integer attribute called self.imageNumber and set its value to 0.

    Timer every 5 seconds Change attribute self.imageNumber to mod(self.imageNumber,3)+1 Constrain attribute self.Image to self.imagePrefix..self.imageNumber

  • ChumCreatureChumCreature Member Posts: 17

    @tatiang said:
    Create a text attribute called self.imagePrefix and set its value to "Image" (without the quotes). Create an integer attribute called self.imageNumber and set its value to 0.

    Timer every 5 seconds Change attribute self.imageNumber to mod(self.imageNumber,3)+1 Constrain attribute self.Image to self.imagePrefix..self.imageNumber

    Use the animate behavior. It's better and more efficient.

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    The 'problem' with the animate behavior is that the request is for a change in image every 5 seconds...

  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2014

    @jamie_c said:
    The 'problem' with the animate behavior is that the request is for a change in image every 5 seconds...

    You can simply drag-duplicate actors within Animate behaviour, so in this case you'd set Animate to 1fps, and then drag-duplicate 5 of each image. It works just fine, although that doesn't feel like a very elegant solution.

    Although saying that I use the method @tatiang posted for most things, also the fast-frame-swap method will do the trick too, as you can enter any value you want for the time multiplier.

    https://forums.gamesalad.com/discussion/63454/fast-frame-swap

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    @Socks, agreed. That would work but would feel 'clunky' at best. :)

  • SocksSocks London, UK.Member Posts: 12,822

    @jamie_c said:
    Socks, agreed. That would work but would feel 'clunky' at best. :)

    Yeah, I edited my post just before you posted to make the very same point, it works just fine but it's not very elegant - and while it's fine for a three frame sequence where each frame is held for 5 seconds, it'd become super-clunky™ with a 40 or 50 image sequence . . .

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    @Socks, hey! you stole my trademark! :)

  • ralphbugsralphbugs Member Posts: 39

    I was also planning to use the animation behaviour but when thinking back I have to animate in AE first then make the sequence made me hold that plan. But never crossed in my mind that I can just duplicate the image in behaviour and set the frame to 1fps like you mentioned Socks. :D

    I'm now try using Tatiang method first (for learning sake) but where do I put the change image behaviour? Inside the timer or just underneath it? Oh, and the Contraint attribute self.image will become blank after each time I preview. I don't know why.

  • SocksSocks London, UK.Member Posts: 12,822

    @ralphbugs said:
    I'm now try using Tatiang method first (for learning sake) but where do I put the change image behaviour? Inside the timer or just underneath it?

    Inside.

  • ralphbugsralphbugs Member Posts: 39

    I think i miss something here. The images does not come out. Could you take a look at this demo project file?

    https://drive.google.com/file/d/0By5DNbqYRGiOUkxUNGZEanVMQ1k/view?usp=sharing

  • SocksSocks London, UK.Member Posts: 12,822

    @ralphbugs said:
    I think i miss something here. The images does not come out. Could you take a look at this demo project file?

    https://drive.google.com/file/d/0By5DNbqYRGiOUkxUNGZEanVMQ1k/view?usp=sharing

  • ralphbugsralphbugs Member Posts: 39
    edited October 2014

    Well, sorry about that. I don't know why I also cannot open the file in the previous link. Though your demo file works! Thank you very much for assisting me :smiley:

  • ralphbugsralphbugs Member Posts: 39

    Here is what I get combining your method. Thanks mate!

    https://drive.google.com/file/d/0By5DNbqYRGiORGtuSjhiSDExWkU/view?usp=sharing

    (have double checked the link and its working now)

Sign In or Register to comment.