ATL problem : zoom anchor, repeat [solved]

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
korova
Veteran
Posts: 217
Joined: Sat Jun 27, 2009 5:15 pm
Completed: Ivy, Chocolate, Time, Clair Obscur
Projects: Writing exercises, The House [Nano18]
Tumblr: korova08
itch: korova
Location: Normandie, France
Contact:

ATL problem : zoom anchor, repeat [solved]

#1 Post by korova »

Hello !

I'm bumping in two different problems in the ATL animation that I want to implement.

What I want to achieve:
I want to show a grey rectangle. Then an image appear, zooming from the center of the rectangle.
After that, I show a slideshow of images, 3 times, than the slide show stops, the last image zoom out to the center of the grey rectangle.

The code I use so far

Code: Select all

transform tv_crime_program:

    transform_anchor True
    align (0.5,0.5)
    zoom 0.0
    linear 0.3 zoom 1.0
    2.0

    block:
        choice:
            "tv blood1" with my_fade
        choice:
            "tv blood3" with my_fade
        2.0
        choice:
            "tv police" with my_fade
        choice:
            "tv corpse" with my_fade
        2.0
        choice:
            "tv blood2" with my_fade
        choice:
            "tv blood4" with my_fade
        2.0
        choice:
            "tv crimetape1" with my_fade
        choice:
            "tv crimetape2" with my_fade
        2.0
        repeat 3


    zoom 1.0
    linear 0.3 zoom 0.0

image tv crime = LiveComposite(
    (425,240),
    (0,0),Solid("#3a3a3a"),
    (0,0), At("tv crimescene",tv_crime_program)
    )
What does not work as planned:
1) no matter what do, the zoom happens from and to the upper left corner, not the center. What I need to change so that the zoom happens from/to the center of the rectangle?

2) The first time I show the image, the slideshow plays nicely, but I need to show that image again, and the next times, the slideshow doesn't play. Is there a way to "reset" the animation each time the image is shown ?
Last edited by korova on Sun Mar 25, 2018 3:56 pm, edited 1 time in total.

User avatar
korova
Veteran
Posts: 217
Joined: Sat Jun 27, 2009 5:15 pm
Completed: Ivy, Chocolate, Time, Clair Obscur
Projects: Writing exercises, The House [Nano18]
Tumblr: korova08
itch: korova
Location: Normandie, France
Contact:

Re: ATL problem : zoom anchor, repeat

#2 Post by korova »

Hello !

I got interested into your problem, and here is what I've done that works.

Code: Select all

# Animation to apply to the fist image
# "on show" ensure that the animation is played each time
transform tv_crime_program:

    on show:

        # démarrage du programme
        # avec un zoom pour simuler l'allumage
        align (0.5,0.5) ## This allows to align the animation from and to the center
        zoom 0.0
        0.5
        linear 0.2 zoom 1.0
        2.0
        # puis simulation zapping avec des fade black rapides
        block:
            choice:
                "tv blood1" with my_fade
            choice:
                "tv blood3" with my_fade
            2.0
            choice:
                "tv police" with my_fade
            choice:
                "tv corpse" with my_fade
            2.0
            choice:
                "tv blood2" with my_fade
            choice:
                "tv blood4" with my_fade
            2.0
            choice:
                "tv crimetape1" with my_fade
            choice:
                "tv crimetape2" with my_fade
            2.0
            repeat 3

        # Extinction avec effet inverse du départ (zoom out)
        zoom 1.0
        linear 0.2 zoom 0.0
I changed the code and put it with the "on show" statement, so that the animation is played each time the image is shown.

I had to get rid of the LiveComposite() images to show the images separatly, like that

Code: Select all

## Watch simple TV program
label tvlounge_watchtv:

    show expression Solid("#3a3a3a") as arriereplan  ## Affichage du fond gris de la télé
    if "ps" in items_location["tvlounge"]:

        show tv crimescene at tv_crime_program:
            pos (438+425/2,143+240/2)
        show tv fromsofa ps as avantplan
        with dissolve
    else:
        show tv crimescene at tv_crime_program:
            pos (426+425/2,121+240/2)
        show tv fromsofa nops as avantplan
        with dissolve


    "I change channels several times, but I bump only on crime stories with murders and blood."
    hide tv
    "I makes me feel uncomfortable so I turn the TV off."

    hide arriereplan
    hide avantplan
    with dissolve
I don't know if it is the best solution ever, but it works, that's all I'm asking.

Thanks! / You're welcome.

Post Reply

Who is online

Users browsing this forum: Google [Bot]