ATL sprite crossfade?

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
Maou Zenigame
Regular
Posts: 66
Joined: Thu Nov 09, 2017 3:09 am
Contact:

ATL sprite crossfade?

#1 Post by Maou Zenigame » Sun Jan 26, 2020 5:26 am

Since the normal Dissolve function disables my text window's transparency while it resolves, I've been messing around with maybe using an ATL version instead:

Code: Select all

transform basicdissolve:
    on show:
        alpha 0.0
        linear 0.4 alpha 1.0
    on hide:
        linear 0.4 alpha 0.0
    on replace:
        alpha 0.0
        linear 0.4 alpha 1.0
    on replaced:
        alpha 1.0
        linear 0.4 alpha 0.0
Thing is, using this causes the sprite to disappear entirely for a bit before the new one fades in. Is there some way to simply fade the new one into the old one?

User avatar
Alex
Lemma-Class Veteran
Posts: 2981
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: ATL sprite crossfade?

#2 Post by Alex » Sun Jan 26, 2020 6:50 am

You need to:
- show first image using this transform,
- use tagged images to automatically hide previouse image.

Try

Code: Select all

label start:
    "..."
    show eileen at center,basicdissolve
    "."
    show eileen happy at right, basicdissolve
    "?!"

Maou Zenigame
Regular
Posts: 66
Joined: Thu Nov 09, 2017 3:09 am
Contact:

Re: ATL sprite crossfade?

#3 Post by Maou Zenigame » Sun Jan 26, 2020 1:25 pm

That works a bit better, though I can still see the background through the sprites as they fade in.

And now there also seems to be an issue where when other transforms are used (like with sprite motions), the original sprite fades out and a new one performs the movement instead of just moving normally.

User avatar
Alex
Lemma-Class Veteran
Posts: 2981
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: ATL sprite crossfade?

#4 Post by Alex » Sun Jan 26, 2020 5:00 pm

What's the actual code you are using?

Maou Zenigame
Regular
Posts: 66
Joined: Thu Nov 09, 2017 3:09 am
Contact:

Re: ATL sprite crossfade?

#5 Post by Maou Zenigame » Sun Jan 26, 2020 5:26 pm

This is the code for the transform:

Code: Select all

transform spriteflinch:
    linear 0.05 yoffset -20
    linear 0.1 yoffset 0

User avatar
gas
Miko-Class Veteran
Posts: 838
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: ATL sprite crossfade?

#6 Post by gas » Sun Jan 26, 2020 9:48 pm

What you want to obtain can't be done with ATL.
You want to crossfade two pictures named the same way. The effect is having the same picture apply the entire alpha reduction, then the entire alpha rising.

You need a transition.
I dunno if that could help you (no way of testing it right now), but this have your dialogue window stay put while you apply a transition on another layer.
https://www.renpy.org/doc/html/transiti ... ransitions
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

strayerror
Regular
Posts: 154
Joined: Fri Jan 04, 2019 3:44 pm
Contact:

Re: ATL sprite crossfade?

#7 Post by strayerror » Mon Jan 27, 2020 8:16 am

If the new image footprint is identical or smaller, and the old image is completely opaque then you can potentially just skip the on replace part so that the new image "pops-in" while obscured by the old as soon as it's used with show, and rely on the on replaced behaviour to fade out the old image revealing the new.

The problem with crossfading sprites is that during the dissolve both the old and new images are transparent to some degree, which as you discovered means whatever is behind them will bleed through. Normal dissolves do not have this issue because they build the whole before and after frames, and then only dissolve one, while the other remains static and opaque.

If your images contain transparency then having the new image "pop-in" behind the old image before it dissolves doesn't work, as it's possible to immediately see it. To the best of my knowledge in such cases you just have to pick the option most palatable to yourself, be that going back to regular full frame dissolves or accepting that during the crossfade the backdrop will become visible, peaking as old and new images pass each other at 50% transparency.

Code: Select all

transform basicdissolve:
    truecenter
    on show:
        alpha 0.0
        linear 0.4 alpha 1.0
    on hide:
        linear 0.4 alpha 0.0
    on replaced:
        alpha 1.0
        linear 0.4 alpha 0.0

label start:
    scene
    label .loop:
    show expression Solid('f00', xysize=(300, 200)) at basicdissolve as box
    'r'
    show expression Solid('0f0', xysize=(300, 200)) at basicdissolve as box
    'g'
    show expression Solid('00f', xysize=(300, 200)) at basicdissolve as box
    'b'
    hide box
    pause
    jump .loop

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]