Ren'Py anim_timebase/zoom + transition in animation

recreation

pure evil!
Respected User
Game Developer
Jun 10, 2018
6,327
22,773
Anyone knows about this? Is there something like this for ATL?
I have a animation where every image zooms in and transitions to the next. The problem is that the transition seems to reset the zoom and the image pops to its original size before the new one shows up :/
I found anim_timebase which seems to be exactly what I need, but it's outdated and doesn't work in ATL.
The animation timebase, used when anim_timebase is True, starts at the instant of the first frame from which the tag of the image containing this animation has been shown on the screen. This can be used to switch between two animations, in a way that ensures they are synchronized to the same timebase. The displayable timebase, used when anim_timebase=False, starts at the first frame after the displayable is shown, and can be used to ensure the entire animation is seen, even if an image with the same tag was already on the screen.
 

recreation

pure evil!
Respected User
Game Developer
Jun 10, 2018
6,327
22,773
Fixed it with a workaraound for now:
Code:
image some_anim:
    "image1.jpg" with dissolve
    ease 7 truecenter zoom 1.1
    "image2.jpg" with dissolve
    ease 7 truecenter zoom 1
    repeat
The second image is still zomed in, so I just zoom out. If I however want the second image to also zoom in, I have to reset it and this causes the "pop" in.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,960
16,195
The problem is that the transition seems to reset the zoom and the image pops to its original size before the new one shows up :/
apply to the actual displayable only. So, if you want it to apply to more than one image, you need to split the process between a displayable and a . Then just apply the transform when you show the displayable.
Something like :
Code:
image myAnim:
    "image1.jpg" with dissolve
    pause 1.0
    "image2.jpg" with dissolve
    pause 1.0
    repeat

transform zoomEffect:
    ease 7 truecenter zoom 1.1
    ease 7 truecenter zoom 1
    repeat

label start:
    show myAnim at zoomEffect
    "WAIT"

Edit: Forgot to also apply the "repeat" to the transform. / Plus correction of what was pointed by Recreation below.
 
  • Like
Reactions: recreation

recreation

pure evil!
Respected User
Game Developer
Jun 10, 2018
6,327
22,773
apply to the actual displayable only. So, if you want it to apply to more than one image, you need to split the process between a displayable and a . Then just apply the transform when you show the displayable.
Something like :
Code:
image myAnim:
    "image1.jpg" with dissolve
    pause 1.0
    "image2.jpg" with dissolve
    pause 1.0
    repeat

image zoomEffect:
    ease 7 truecenter zoom 1.1
    ease 7 truecenter zoom 1
    repeat

label start:
    show myAnim at zoomEffect
    "WAIT"

Edit: Forgot to also apply the "repeat" to the transform.
Works like a charm. Again I was thinking too complex xD

btw if someone also needs this code in the future:
Code:
image zoomEffect:
should be:
Code:
transform zoomEffect:
:p

Thx again @anne O'nymous
 

mickydoo

Fudged it again.
Game Developer
Jan 5, 2018
2,446
3,557
apply to the actual displayable only. So, if you want it to apply to more than one image, you need to split the process between a displayable and a . Then just apply the transform when you show the displayable.
Something like :
Code:
image myAnim:
    "image1.jpg" with dissolve
    pause 1.0
    "image2.jpg" with dissolve
    pause 1.0
    repeat

transform zoomEffect:
    ease 7 truecenter zoom 1.1
    ease 7 truecenter zoom 1
    repeat

label start:
    show myAnim at zoomEffect
    "WAIT"

Edit: Forgot to also apply the "repeat" to the transform. / Plus correction of what was pointed by Recreation below.
Yay forum search. I just put this in my game after getting half the answer from google.
Code:
scene pennyroom12:

                ease 0.5 truecenter zoom 2
Which works, except she is not zooming straight in, it more all less looks like its following a question mark shape, looping off to the right before coming back to the center, it's making me dizzy. I tried just center but that just makes it go off center.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,960
16,195
Which works, except she is not zooming straight in, it more all less looks like its following a question mark shape, looping off to the right before coming back to the center, it's making me dizzy.
Just tried it, and it's more weird than that...

I did it with a static image and :
Code:
transform anim:
    ease 7 truecenter zoom 2
    ease 7 truecenter zoom 1
    repeat
The first zoom in is, like you said, moving. The zoom out stay fixed on the center... Then come the weirdest thing, starting this the zoom in stay fixed. Even replacing truecenter by xalign 0.5 yalign 0.5 or using / don't solve the problem.

So I tried something weird :
Code:
transform anim:
    linear 2 truecenter zoom 1.1
    linear 2 truecenter zoom 1.2
    linear 2 truecenter zoom 1.3
    linear 2 truecenter zoom 1.4
    linear 2 truecenter zoom 1.5
    linear 2 truecenter zoom 1.6
    linear 2 truecenter zoom 1.7
    linear 2 truecenter zoom 1.8
    linear 2 truecenter zoom 1.9
    linear 2 truecenter zoom 2.0
    linear 2 truecenter zoom 1.0
    repeat
And the fucking same moving pattern happen the first time it zoom in ; while again not happening after.

The worse part is that this moving pattern looks like what would happened if you try to zoom in with binoculars or a camera ; you never stay true to the center and adjust the framing, but once you've done it, you don't need to adjust whatever you zoom in or out. So, it's (more than) possible that PyTom did it voluntarily because he thought that it should be done like this. Apart from editing the code for the zoom or creating your own zoom, I don't think that there's a solution to this problem ; perhaps persuading PyTom to add a true stable zoom ? :/
 
  • Like
Reactions: mickydoo

mickydoo

Fudged it again.
Game Developer
Jan 5, 2018
2,446
3,557
Haha all good, thanks for trying, It was just something I was trying to teach myself, my renders are all 3200x1800 and reduced so i can sort of make something with the larger image that will suffice.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,960
16,195
my renders are all 3200x1800 and reduced so i can sort of make something with the larger image that will suffice.
It bother me because I had more or less the same kind of idea ; offering to the player the possibility to zoom here or there. So I tried more, and I'm now completely lost, because it's not limited to the zoom property. I thought about a workaround with :
Code:
transform anim:
    size( 1920, 1080 )
    linear 7 truecenter size( 1920*2, 1080*2 )
    linear 7 truecenter size( 1920, 1080 )
    repeat
But the result is exactly the same pattern.


This said, I'm stubborn and bored today, which lead to an effective workaround with the help of the ATL property.
Python:
init python:

    # Warning, /truecenter/ is already used in the store.
    def trueCenter( trans ):
        #  /xalign/ is just an alias for xpos=xanchor=value,
        # same for /yalign/.
        trans.xpos = 0.5
        trans.ypos = 0.5
        trans.xanchor = 0.5
        trans.yanchor = 0.5

    #  /trans/ is the target, a renpy.display.transform.Transform
    # object. See [...]/renpy/display/transform.py:434 and
    # following. In short, change its value, you'll change what is
    # seen.
    #  /st/ is the elapsed time since the animation started.
    #  Forget about /at/ :D
    def breathin_function(trans, st, at):
        # Fix the position to the center
        trueCenter( trans )
        # The delay is 2 seconds.
        if st > 2.0:
            #  We finished, the value should already be 2.0 but
            # enforce it.
            trans.zoom = 2.0
            #  /None/ mean, don't call me anymore.
            return None
        else:
            #  Define the new zoom factor. We start at 1.0, want
            # to end at 2.0 after 2 seconds So increment by half
            # the time elapsed.
            trans.zoom = 1.0 + ( st / 2 )
            #  Please, call me as soon as possible.
            return 0

    # Same than above, but from 2.0 to 1.0
    def breathout_function(trans, st, at):
        trueCenter( trans )
        if st > 2.0:
            trans.zoom = 1.0
            return None
        else:
            trans.zoom = 2.0 - ( st / 2 )
            return 0

label start:
    show myTestPict:
        function breathin_function
        function breathout_function
        repeat
It zoom in, then out, with a 2.0 factor following a linear pattern of 2 seconds.
It's possible to do the same with an ease pattern, but it need more computation when changing the zoom value in the else part.
 
  • Like
Reactions: mickydoo

mickydoo

Fudged it again.
Game Developer
Jan 5, 2018
2,446
3,557
I gotta render out an animation this morning while I fuck off up town for a while, I'll have a play with this myself later on this afternoon (its only 8 am here) and let you you know how i go.
 

recreation

pure evil!
Respected User
Game Developer
Jun 10, 2018
6,327
22,773
I gotta render out an animation this morning while I fuck off up town for a while, I'll have a play with this myself later on this afternoon (its only 8 am here) and let you you know how i go.
12:44 AM :p
I used a slow zoom (8 seconds) and this effect adds a nicely to the animation in my case, but of course it's weird on faster animations.
 
  • Like
Reactions: mickydoo