Ren'Py Is there a way to delay the loop of a WebM animation?

MissFortune

I Was Once, Possibly, Maybe, Perhaps… A Harem King
Respected User
Game Developer
Aug 17, 2019
4,827
7,922
Basically, my code looks something like this:

Python:
image settingsvid = Movie(play="gui/missfortune/buttons/animbuttons/settings/settings.webm", mask="gui/missfortune/buttons/animbuttons/settings/settingsmask.webm", start_image="gui/missfortune/buttons/animbuttons/settings/settings01.png", image="gui/missfortune/buttons/animbuttons/settings/settings43.png", loop=True)
What I'm looking to do is have the full animation play and then pause, for example, say thirty seconds before looping it again. I skimmed through a few seemingly related docs but didn't find much beyond pauses for ATL animations.
 

Winterfire

Forum Fanatic
Respected User
Game Developer
Sep 27, 2018
5,037
7,374
I think this is what you are looking for:

Delay
The number of seconds to wait before ending the cutscene. Normally the length of the movie, in seconds. If None, then the delay is computed from the number of loops (that is, loops + 1) * the length of the movie. If -1, we wait until the user clicks.
 

Nicke

Well-Known Member
Game Developer
Jul 2, 2017
1,178
3,025
What I'm looking to do is have the full animation play and then pause, for example, say thirty seconds before looping it again. I skimmed through a few seemingly related docs but didn't find much beyond pauses for ATL animations.
If it's a 30fps 3-second animation you want to loop with a 30 second delay at the end, just make the animation 33 seconds long with the last frame used 900 times at the end.

Kek.
 

Deleted member 2282952

Developing I SCREAM
Game Developer
May 1, 2020
416
869
If it's a 30fps 3-second animation you want to loop with a 30 second delay at the end, just make the animation 33 seconds long with the last frame used 900 times at the end.

Kek.
That's almost how I would do it.

Basically, my code looks something like this:

Python:
image settingsvid = Movie(play="gui/missfortune/buttons/animbuttons/settings/settings.webm", mask="gui/missfortune/buttons/animbuttons/settings/settingsmask.webm", start_image="gui/missfortune/buttons/animbuttons/settings/settings01.png", image="gui/missfortune/buttons/animbuttons/settings/settings43.png", loop=True)
What I'm looking to do is have the full animation play and then pause, for example, say thirty seconds before looping it again. I skimmed through a few seemingly related docs but didn't find much beyond pauses for ATL animations.
I would make two videos: a still frame video and an animation video, then play them back to back. It would give you some variability too cause you can still use videos of different lengths.

Smth like:

Code:
image settingsvid = Movie(
    play=["gui/missfortune/buttons/animbuttons/settings/settings.webm", "gui/missfortune/buttons/animbuttons/settings/settings_pause.webm"])
If the above syntax is incorrect, then just two separate movies
 
  • Like
Reactions: MissFortune

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,302
15,172
I skimmed through a few seemingly related docs but didn't find much beyond pauses for ATL animations.
Well, since you used 30 seconds as example, I assume that it's for a background movie, therefore normally this should do it, letting you with "settings43.png" as static image during the loop:
Python:
image movieWithWait:
    # /!\ you MUST set the /loop/ at *False* /!\
    Movie(play="gui/missfortune/buttons/animbuttons/settings/settings.webm", mask="gui/missfortune/buttons/animbuttons/settings/settingsmask.webm", start_image="gui/missfortune/buttons/animbuttons/settings/settings01.png", image="gui/missfortune/buttons/animbuttons/settings/settings43.png", loop=False)
    pause 30
    repeat

View the name of the movie, I guess that it's for a screen background. So alternatively this should also works:
Python:
screen whatever():

    default img = "settingsvid"

    if img == "settings43":
        # 30 -> pause time before the next loop.
        timer 30 repeat False  action SetLocalVariable( "img", "settingsvid" )
    elif img == "settingsvid":
        # 3 -> duration of the movie + 0.02 second as security net.
        timer 3.02 repeat False action SetLocalVariable( "img", "settings43" )

    fixed:
        add img

        frame:
            [your full screen]
For better result, once again define your movie with loop=False to avoid glitches. It's the same reason why the duration is a bit longer than the movie duration.
Since you have no guaranty that Ren'Py or the OS will not be a bit busy, you can't expect the movie timer to be accurate to the hundredth of second. Therefore having a bit longer delay, coupled to the "image" parameter when you define the movie, should make it smooth even when the timer isn't precise enough.
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,576
2,204
What I'm looking to do is have the full animation play and then pause, for example, say thirty seconds before looping it again.

To offer a very low tech potential solution... If you're creating the animation yourself... why not just add 30 seconds of pure black image to the end of the current animation? 30 second of black shouldn't increase the overall image size too much. Though you might need to play with the video quality settings to avoid the artifacting that can happen with solid colors in large areas of the frame.

Rather than do it in RenPy... do it in Adobe Premiere or Daz or Blender or whatever your movie editor of choice is.

Or... since the video channel is treated like an audio channel. Do some of the audio functions like work?
I'm thinking not. But it was a random idea that popped into my head.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,302
15,172
Or... since the video channel is treated like an audio channel. Do some of the audio functions like work?
I'm thinking not. But it was a random idea that popped into my head.
It was a nice thinking, so I tried it, and it works, but it also don't.

What I mean is that, as you expected, you can use play to play a movie.

But you can't play a Movie object. Declared with image Ren'Py will not find it, and declared with define Ren'Py will complain. Therefore you're limited to play movie "path/name.ext".

Starting the moment you can use play, you can also use silence, and play movie [ "<silence 2>", "path/name.ext" ] effectively works.
But unlike the audio, sound and music channels, that are treated in the background, when Ren'py is playing something on the movie channel, it stop the progression of the game until the movie is fully played. And it stop it completely, you can't even click to advance ; you are stuck watching the movie until it's end.
I tried to trick Ren'Py, playing the movie on another channel, and... Well, Ren'Py is a smart ass. It play it, but only the audio part.

So, while using play with a movie works, it's relatively useless, because more annoying and limited than anything else.
 

Deleted member 2282952

Developing I SCREAM
Game Developer
May 1, 2020
416
869
It was a nice thinking, so I tried it, and it works, but it also don't.

What I mean is that, as you expected, you can use play to play a movie.

But you can't play a Movie object. Declared with image Ren'Py will not find it, and declared with define Ren'Py will complain. Therefore you're limited to play movie "path/name.ext".

Starting the moment you can use play, you can also use silence, and play movie [ "<silence 2>", "path/name.ext" ] effectively works.
But unlike the audio, sound and music channels, that are treated in the background, when Ren'py is playing something on the movie channel, it stop the progression of the game until the movie is fully played. And it stop it completely, you can't even click to advance ; you are stuck watching the movie until it's end.
I tried to trick Ren'Py, playing the movie on another channel, and... Well, Ren'Py is a smart ass. It play it, but only the audio part.

So, while using play with a movie works, it's relatively useless, because more annoying and limited than anything else.
That's an interesting breakdown, thanks