u/HEXdidnt

▲ 2 r/RenPy

Randomised TintMatrix on an infinitely repeating background element

I've had the crazy idea of adding a repeating, scrolling strip layer to the background of a scene, and then change its colour at random intervals. I have the following:

init python:
    import random
    fogcolours = [
        "#4040ff",
        "#00e0e0",
        "#e0f000",
        "#e800e8",
        "#00f0c8",
        "#f08000",
    ]


    def randomfog(st, at):
        fogshiftcolor = random.choice(fogcolours)
        d = Transform (
            "carbg/smokey strip.webp",
            matrixcolor=TintMatrix(fogshiftcolor)
        )
        return d, random.uniform(0.5, 6.0)


image repeatingcolourfog:
    DynamicDisplayable(randomfog)
    xoffset 0
    linear 2.0 xoffset -2624
    repeat

But each change to the colour restarts the animation and, while it's not overly obvious unless you're looking for it, I'd prefer the colour change to happen without popping the animation back to the beginning each time.

Is that possible?

reddit.com
u/HEXdidnt — 2 days ago