Panning an image up

TessSadist

Well-Known Member
Donor
Game Developer
Aug 4, 2019
1,298
5,526
Hi all!

I started searching the Renpy documentation but thought I would also try here as well. I'm just trying to figure out how to pan an image up or down easily. For example, you would have a basic image of a character and you just want to pan up from say their feet going up to their face. Do I need to make the image bigger than normal and then pan it up/down to say a 1080 type image from a larger size? Or is there a simpler way to do this? Sorry for the newbie question, just trying to learn, thanks!

This image isn't the best example for sure, but something like say panning from bottom to top of body/face of character...
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,561
2,183
I'm just trying to figure out how to pan an image up or down easily.
Good news... it is easy.

Do I need to make the image bigger than normal and then pan it up/down to say a 1080 type image from a larger size?
Making a double height image is probably easiest if you plan to scroll up and down the image.
Though, if you already have an image - you can just zoom in.

Using your existing image... this works...

Python:
    scene intro1 with dissolve:
        xalign 0.5 yalign 1.0 zoom 2.0
        linear 4.0 yalign 0.0
    pause 4.0
Zooming in to double size does mean your image quality will suffer a bit... hence the suggestion to render a double sized image. Though it only has to be double height (1920x2160 for example).

Talking through the code...

scene intro1 with dissolve: you should already be familiar with. A new scene with dissolve transition using an image called intro1 (you don't need to include the file extention).

xalign and yalign are how RenPy aligns the image on the screen. 0.0 is left or top. 1.0 is right or bottom. 0.5 is the middle. You can use absolute pixels, but I tend to think align makes it simpler when thinking about different devices or different screen sizes.
Normally, 0.0, 0.5, 1.0 don't actually matter... since images tend to be the same size as the screen. But if the image is smaller or bigger... then align matters. I think the default is to center the image. Edit: The default is xalign 0.5 yalign 1.0 (centered horizontally, but anchored at the bottom of the screen).

The first line tells RenPy where the image will start.
So xalign 0.5 yalign 1.0 zoom 2.0 says "center the image left/right, zoom in to double size and start with the bottom edge of the image against the bottom edge of the screen".

The next line tells RenPy how to transition to the next stage of the image.
So linear 4.0 yalign 0.0 says "use the linear transition to progress, take 4.0 seconds to move from the start to the finish and the final state should leave the top edge of the image against the top edge of the screen". Meanwhile, leave all other attributes alone (so zoom 2.0 and xalign 0.5 remain unchanged).

Finally, the pause 4.0 tells RenPy to wait 4 seconds before continuing... which will means the animation will complete before the game continues (assuming the player doesn't just click through it).

Which is fine... and answers your question.

However, I have a few tweaks to offer.

Firstly, your image isn't centered. But it can be... since you're zoomed in to double size. xalign 0.54 instead of xalign 0.5 sorts that out nicely in my eyes.

Next... your animation doesn't have to be quite that simple.
Perhaps swap linear for easein which starts slow and speeds up as it moves forward. I think this looks best when panning up a character like you have planned.

Also... you can vary the zoom amount too. Perhaps start slightly further back and zoom into her face a little more during the transition. Though again... zooming in a lot highlights any imperfections in the render.

One tweak I like to make is to have the game continue slightly ahead of the animation finishing. So if your easein 4.0 is going to take 4 seconds... have your next line of dialogue appear after 2 seconds using pause 2.0 instead. (Personal preference of course).

Finally... You don't have to just use a single transition.

After you've tried the code above... try this too. You might prefer the results... or at least know enough to pick and choose the bits you like and the bits you don't.

Python:
label start:

    scene black with fade

    "Start:.... "

    scene intro1 with dissolve:
        xalign 0.54 yalign 1.0 zoom 1.5
        easein 4.0 yalign 0.0 zoom 3.0
        easeout 1.0 xalign 0.53 yalign 0.16 zoom 4.0
        pause 0.5
        linear 1.0 xalign 0.54 yalign 0.0 zoom 3.0
        pause 0.5
        linear 0.25 xalign 0.5 yalign 0.5 zoom 1.0
    pause 4.0
    "What are you looking at?"

    "*** THE END ***"

    return
The section of the RenPy documentation you are looking for is .

xalign, yalign and zoom are only the tip of the iceberg. You can go nuts and create really complex animation by mixing in . The easein and linear transforms are called warpers... they are detailed (although they are more about controlling the timing as much as anything else).

Personally, as I say, I'd create a double height render... even if you end up using zoom 4.0.
That said... you're talking about 4 seconds out of a game that will take hours to play. Most players won't care if you don't re-render to create a "better" image when zoomed in. A large number won't even notice.
 
Last edited:

TessSadist

Well-Known Member
Donor
Game Developer
Aug 4, 2019
1,298
5,526
Good news... it is easy.


Making a double height image is probably easiest if you plan to scroll up and down the image.
Though, if you already have an image - you can just zoom in.

Using your existing image... this works...

Python:
    scene intro1 with dissolve:
        xalign 0.5 yalign 1.0 zoom 2.0
        linear 4.0 yalign 0.0
    pause 4.0
Zooming in to double size does mean your image quality will suffer a bit... hence the suggestion to render a double sized image. Though it only has to be double height (1920x2160 for example).

Talking through the code...

scene intro1 with dissolve: you should already be familiar with. A new scene with dissolve transition using an image called intro1 (you don't need to include the file extention).

xalign and yalign are how RenPy aligns the image on the screen. 0.0 is left or top. 1.0 is right or bottom. 0.5 is the middle. You can use absolute pixels, but I tend to think align makes it simpler when thinking about different devices or different screen sizes.
Normally, 0.0, 0.5, 1.0 don't actually matter... since images tend to be the same size as the screen. But if the image is smaller or bigger... then align matters. I think the default is to center the image.

The first line tells RenPy where the image will start.
So xalign 0.5 yalign 1.0 zoom 2.0 says "center the image left/right, zoom in to double size and start with the bottom edge of the image against the bottom edge of the screen".

The next line tells RenPy how to transition to the next stage of the image.
So linear 4.0 yalign 0.0 says "use the linear transition to progress, take 4.0 seconds to move from the start to the finish and the final state should leave the top edge of the image against the top edge of the screen". Meanwhile, leave all other attributes alone (so zoom 2.0 and xalign 0.5 remain unchanged).

Finally, the pause 4.0 tells RenPy to wait 4 seconds before continuing... which will means the animation will complete before the game continues (assuming the player doesn't just click through it).

Which is fine... and answers your question.

However, I have a few tweaks to offer.

Firstly, your image isn't centered. But it can be... since you're zoomed in to double size. xalign 0.54 instead of xalign 0.5 sorts that out nicely in my eyes.

Next... your animation doesn't have to be quite that simple.
Perhaps swap linear for easein which starts slow and speeds up as it moves forward. I think this looks best when panning up a character like you have planned.

Also... you can vary the zoom amount too. Perhaps start slightly further back and zoom into her face a little more during the transition. Though again... zooming in a lot highlights any imperfections in the render.

One tweak I like to make is to have the game continue slightly ahead of the animation finishing. So if your easein 4.0 is going to take 4 seconds... have your next line of dialogue appear after 2 seconds using pause 2.0 instead. (Personal preference of course).

Finally... You don't have to just use a single transition.

After you've tried the code above... try this too. You might prefer the results... or at least know enough to pick and choose the bits you like and the bits you don't.

Python:
label start:

    scene black with fade

    "Start:.... "

    scene intro1 with dissolve:
        xalign 0.54 yalign 1.0 zoom 1.5
        easein 4.0 yalign 0.0 zoom 3.0
        easeout 1.0 xalign 0.53 yalign 0.16 zoom 4.0
        pause 0.5
        linear 1.0 xalign 0.54 yalign 0.0 zoom 3.0
        pause 0.5
        linear 0.25 yalign 0.5 zoom 1.0
    pause 4.0
    "What are you looking at?"

    "*** THE END ***"

    return
The section of the RenPy documentation you are looking for is .

xalign, yalign and zoom are only the tip of the iceberg. You can go nuts and create really complex animation my mixing in . The easein and linear transforms are called warpers... they are detailed (although they are more about controlling the timing as much as anything else).

Personally, as I say, I'd create a double height render... even if you end up using zoom 4.0.
That said... you're talking about 4 seconds out of a game that will take hours to play. Most players won't care if you don't re-render to create a "better" image when zoomed in. A large number won't even notice.
Wow! You just made a tech question very easy to follow for a non-tech person like myself, thank you so much!
 

RustyV

Conversation Conqueror
Game Developer
Dec 30, 2017
6,659
30,698
Good news... it is easy.


Making a double height image is probably easiest if you plan to scroll up and down the image.
Though, if you already have an image - you can just zoom in.

Using your existing image... this works...

Python:
    scene intro1 with dissolve:
        xalign 0.5 yalign 1.0 zoom 2.0
        linear 4.0 yalign 0.0
    pause 4.0
Zooming in to double size does mean your image quality will suffer a bit... hence the suggestion to render a double sized image. Though it only has to be double height (1920x2160 for example).

Talking through the code...

scene intro1 with dissolve: you should already be familiar with. A new scene with dissolve transition using an image called intro1 (you don't need to include the file extention).

xalign and yalign are how RenPy aligns the image on the screen. 0.0 is left or top. 1.0 is right or bottom. 0.5 is the middle. You can use absolute pixels, but I tend to think align makes it simpler when thinking about different devices or different screen sizes.
Normally, 0.0, 0.5, 1.0 don't actually matter... since images tend to be the same size as the screen. But if the image is smaller or bigger... then align matters. I think the default is to center the image. Edit: The default is xalign 0.5 yalign 1.0 (centered horizontally, but anchored at the bottom of the screen).

The first line tells RenPy where the image will start.
So xalign 0.5 yalign 1.0 zoom 2.0 says "center the image left/right, zoom in to double size and start with the bottom edge of the image against the bottom edge of the screen".

The next line tells RenPy how to transition to the next stage of the image.
So linear 4.0 yalign 0.0 says "use the linear transition to progress, take 4.0 seconds to move from the start to the finish and the final state should leave the top edge of the image against the top edge of the screen". Meanwhile, leave all other attributes alone (so zoom 2.0 and xalign 0.5 remain unchanged).

Finally, the pause 4.0 tells RenPy to wait 4 seconds before continuing... which will means the animation will complete before the game continues (assuming the player doesn't just click through it).

Which is fine... and answers your question.

However, I have a few tweaks to offer.

Firstly, your image isn't centered. But it can be... since you're zoomed in to double size. xalign 0.54 instead of xalign 0.5 sorts that out nicely in my eyes.

Next... your animation doesn't have to be quite that simple.
Perhaps swap linear for easein which starts slow and speeds up as it moves forward. I think this looks best when panning up a character like you have planned.

Also... you can vary the zoom amount too. Perhaps start slightly further back and zoom into her face a little more during the transition. Though again... zooming in a lot highlights any imperfections in the render.

One tweak I like to make is to have the game continue slightly ahead of the animation finishing. So if your easein 4.0 is going to take 4 seconds... have your next line of dialogue appear after 2 seconds using pause 2.0 instead. (Personal preference of course).

Finally... You don't have to just use a single transition.

After you've tried the code above... try this too. You might prefer the results... or at least know enough to pick and choose the bits you like and the bits you don't.

Python:
label start:

    scene black with fade

    "Start:.... "

    scene intro1 with dissolve:
        xalign 0.54 yalign 1.0 zoom 1.5
        easein 4.0 yalign 0.0 zoom 3.0
        easeout 1.0 xalign 0.53 yalign 0.16 zoom 4.0
        pause 0.5
        linear 1.0 xalign 0.54 yalign 0.0 zoom 3.0
        pause 0.5
        linear 0.25 xalign 0.5 yalign 0.5 zoom 1.0
    pause 4.0
    "What are you looking at?"

    "*** THE END ***"

    return
The section of the RenPy documentation you are looking for is .

xalign, yalign and zoom are only the tip of the iceberg. You can go nuts and create really complex animation by mixing in . The easein and linear transforms are called warpers... they are detailed (although they are more about controlling the timing as much as anything else).

Personally, as I say, I'd create a double height render... even if you end up using zoom 4.0.
That said... you're talking about 4 seconds out of a game that will take hours to play. Most players won't care if you don't re-render to create a "better" image when zoomed in. A large number won't even notice.
I've tried this and I still can't get the image to pan from the bottom up.
 
Apr 18, 2021
370
788
That shit is too complicated.
Do this to save time.
In Renpy, with your project open, create a new file, save it in your renpy/game folder and name it "custom_atl.rpy"

Put this text in the new file:
transform pan:
yalign 1.0
linear 8.0 yalign 0.0
Then all you have to do in your script whenever you want to use it is write:
show yourimagename at pan
pause 8