How to Animate a Blink with Two Layers?

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
ArizaLuca
Veteran
Posts: 241
Joined: Tue Feb 20, 2018 12:59 pm
Completed: Through the Screen, Riddle Me This, Trust Fall, Phobias, Another Adventure
Projects: The Souls in the Seams, Fata Morgana, Minecraft: Story Mode - Behind the Scenes
Organization: Astral Autumn Games
Tumblr: astralautumngames
Deviantart: ArizaLuca
itch: astralautumngames
Contact:

How to Animate a Blink with Two Layers?

#1 Post by ArizaLuca »

So I have a character that blinks, but the shine is a second layer that would overlay the eyes. I want to animate the blink so that the shine won't show up when the eye is closed, but will show up when the eye is open. Does anyone know how to do that?

The code I'm currently looking at is from the Ren'Py wiki, so I don't know if it's still applicable.

Code: Select all

image girl eyes normal:
    "eye_open.png"
    choice:
        4.5
    choice:
        3.5
    choice:
        1.5
    # This randomizes the time between blinking.
    "eye_closed.png"
    .25
    repeat

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: How to Animate a Blink with Two Layers?

#2 Post by kivik »

Am I right in thinking that you've got two layers: girl and shine, and you've got two versions of the girl image with eyes open and eyes closed?

If that's the case, how difficult would it be to break it into 3 layers: girl, shine, eyes?

I'm guessing from your image naming convention that you have different eyes for the girl - maybe a separate layer would actually make life much easier going forward?

ArizaLuca
Veteran
Posts: 241
Joined: Tue Feb 20, 2018 12:59 pm
Completed: Through the Screen, Riddle Me This, Trust Fall, Phobias, Another Adventure
Projects: The Souls in the Seams, Fata Morgana, Minecraft: Story Mode - Behind the Scenes
Organization: Astral Autumn Games
Tumblr: astralautumngames
Deviantart: ArizaLuca
itch: astralautumngames
Contact:

Re: How to Animate a Blink with Two Layers?

#3 Post by ArizaLuca »

No, that's just the example code. I only have the eyes and then the shine layer. The body is a completely different matter that I don't need.

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: How to Animate a Blink with Two Layers?

#4 Post by kivik »

Ah sorry for misunderstanding, also I realised my suggestion wouldn't work anyway as the shine has to go above the eyes - which makes me think:

Have an eye lid layer (eye closed) that goes from blank to completely visible. That will cover the shine layer and thus it won't show anymore.

That means: body / head > eyes > shine > eyelids


I couldn't find anything on triggering another image to disappear based on an image's own states unfortunately so I don't know if it's possible at all to do it that way. Maybe there's a lower level (pygame or python) callback you could use, but I think the eyelid as separate layer may be the easiest to implement. Hope that was helpful in some small way!

ArizaLuca
Veteran
Posts: 241
Joined: Tue Feb 20, 2018 12:59 pm
Completed: Through the Screen, Riddle Me This, Trust Fall, Phobias, Another Adventure
Projects: The Souls in the Seams, Fata Morgana, Minecraft: Story Mode - Behind the Scenes
Organization: Astral Autumn Games
Tumblr: astralautumngames
Deviantart: ArizaLuca
itch: astralautumngames
Contact:

Re: How to Animate a Blink with Two Layers?

#5 Post by ArizaLuca »

Hmm, I see. I don't think I can do that unfortunately...

So what I have for layers is the open eyes, the shine, and then the closed eye. I only need to implement the shine over the open eye. Is there a way to do that?

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: How to Animate a Blink with Two Layers?

#6 Post by kivik »

Ah, am I right in thinking then that the shine is actually a glowing effect that goes outside of the eyes then? If so, can you animate the shine layer instead?

Code: Select all

image eye shine:
    "[shine_option]_open.png" # use a variable to determine which shine image to use
    choice:
        4.5
    choice:
        3.5
    choice:
        1.5
    # This randomizes the time between blinking.
    "shine_closed.png" # if the shine is gone you can just use the closed eye image
    .25
    repeat

User avatar
CalixtheGreat
Regular
Posts: 72
Joined: Thu Jun 08, 2017 12:00 am
Projects: Zephyr Breeze Investigations
itch: calixthegreat
Location: Philippines
Contact:

Re: How to Animate a Blink with Two Layers?

#7 Post by CalixtheGreat »

Why don't you try to use animation instead:

Example untested code:

Code: Select all

image girl eyes normal:
	Animation ("eye_open.png", 3,
		"eye_shine.png", .5,
		"eyes_closed.png", .5)

Image
FB PAGE:
CALIX THE GREAT

ArizaLuca
Veteran
Posts: 241
Joined: Tue Feb 20, 2018 12:59 pm
Completed: Through the Screen, Riddle Me This, Trust Fall, Phobias, Another Adventure
Projects: The Souls in the Seams, Fata Morgana, Minecraft: Story Mode - Behind the Scenes
Organization: Astral Autumn Games
Tumblr: astralautumngames
Deviantart: ArizaLuca
itch: astralautumngames
Contact:

Re: How to Animate a Blink with Two Layers?

#8 Post by ArizaLuca »

The shine is like an anime shine in which the eyes look more, well, shiny with them. The problem with the most recent post is that it assumes that the eye is simply on one layer, when there are two separate layers to the eyes. It's not really a 'glow' effect but is layered right on top of the eyes.

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: How to Animate a Blink with Two Layers?

#9 Post by kivik »

If it just go right on top of the eyes, then an eyelid layer above it that completely covers the shine should work.

I think my last suggestion should work as well as a work around, because basically you either have the shine, or the eyelid.

Is there any particular reason either of those methods won't work for you?

ArizaLuca
Veteran
Posts: 241
Joined: Tue Feb 20, 2018 12:59 pm
Completed: Through the Screen, Riddle Me This, Trust Fall, Phobias, Another Adventure
Projects: The Souls in the Seams, Fata Morgana, Minecraft: Story Mode - Behind the Scenes
Organization: Astral Autumn Games
Tumblr: astralautumngames
Deviantart: ArizaLuca
itch: astralautumngames
Contact:

Re: How to Animate a Blink with Two Layers?

#10 Post by ArizaLuca »

I already drew the layers, the eyelid is incorporated right onto the eye and it can't change. There's an open eye, a closed eye, and the shine only shows up on the open eye. (The eyes itself are one layer, while the shine a separate layer). The shine isn't part of the eye layer.

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: How to Animate a Blink with Two Layers?

#11 Post by kivik »

Sorry I'm a bit confused, but am I not right in thinking that you have an eye closed image?

Can you share a few of your images please so I can understand better what you have to hand?


I'm still under the impression that you have at least 3 images: eye opened, eye closed, shine. And you have two layers: eye layer, shine layer.

If that's the case, you just need to change the eye close image to be used in the shine layer, so that it goes between shine being shown:

eye open + shine

and eye closed:

eye open + eye closed


Ah, do you mean your eye closed image cannot cover the eye open image entirely? And it's not possible to redo all the eye closed images? Sorry if that's the case! Then my solution definitely won't work!

Corynth
Regular
Posts: 66
Joined: Thu Dec 01, 2011 7:59 am
Completed: Halloween Otome, Valentines Otome
Projects: Christmas Otome
Organization: Synokoria
Tumblr: synokoria
Deviantart: Corynth-Synokoria
itch: synokoria
Contact:

Re: How to Animate a Blink with Two Layers?

#12 Post by Corynth »

How about compositing the shine and open eye?

Code: Select all

image girl eyes normal:
    LiveComposite((775, 1400), #replace 775 and 1400 with the width and height respectively
        (0, 0), "eye_open.png",
        (0, 0), "eye_shine.png"
    )
    choice:
        4.5
    choice:
        3.5
    choice:
        1.5
    # This randomizes the time between blinking.
    "eye_closed.png"
    .25
    repeat

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: How to Animate a Blink with Two Layers?

#13 Post by kivik »

Corynth wrote: Thu Apr 12, 2018 11:04 am How about compositing the shine and open eye?

Code: Select all

image girl eyes normal:
    LiveComposite((775, 1400), #replace 775 and 1400 with the width and height respectively
        (0, 0), "eye_open.png",
        (0, 0), "eye_shine.png"
    )
    choice:
        4.5
    choice:
        3.5
    choice:
        1.5
    # This randomizes the time between blinking.
    "eye_closed.png"
    .25
    repeat
Ooh nice! I bet that will work! Sorry for my silly suggestion!

ArizaLuca
Veteran
Posts: 241
Joined: Tue Feb 20, 2018 12:59 pm
Completed: Through the Screen, Riddle Me This, Trust Fall, Phobias, Another Adventure
Projects: The Souls in the Seams, Fata Morgana, Minecraft: Story Mode - Behind the Scenes
Organization: Astral Autumn Games
Tumblr: astralautumngames
Deviantart: ArizaLuca
itch: astralautumngames
Contact:

Re: How to Animate a Blink with Two Layers?

#14 Post by ArizaLuca »

That worked really well! Thanks so much for all the help!

Post Reply

Who is online

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