# Changing image background with given specific time

**URL:** <https://discourse.processing.org/t/changing-image-background-with-given-specific-time/38186>\
**Category:** Beginners\
**Tags:** homework\
**Created:** [August 1, 2022, 1:51pm UTC](https://discourse.processing.org/t/changing-image-background-with-given-specific-time/38186 "2022-08-01T13:51:32Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![mnse](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mnse/32/16520_2.png) [@mnse](https://discourse.processing.org/u/mnse)\
**Post date:** [August 1, 2022, 2:51pm UTC](https://discourse.processing.org/t/changing-image-background-with-given-specific-time/38186/3 "2022-08-01T14:51:56Z")

</div>

Hi @steven,

Pretty much everything listed you need by @glv.

Maybe some meta description…

```auto
On start
    Create an array with available images.
    Initialize variables for currentImageindex and nextUpdateTime with suitable values 

On draw loop
    check if currentTime >= nextUpdateTime
    If true
        increment currentImageindex mod size of image array
        add interval to nextUpdateTime
    set background using currentImageIndex on available images

```

Cheers  
— mnse

---

_[View the full topic](https://discourse.processing.org/t/changing-image-background-with-given-specific-time/38186)._
