First-person blinking effect? - Lemma Soft Forums (2024)

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

  • Print view

12 posts• Page 1 of 1

Message

Author

Rosstin2
Veteran
Posts: 253
Joined: Thu Jan 09, 2014 12:42 pm
Completed: King's Ascent, Kitty Love
Projects: Queen At Arms, Rex Rocket
Organization: Aqualuft Games
Contact:

Contact Rosstin2

Send private messageWebsite

First-person blinking effect?

  • Quote

#1Postby Rosstin2 »

Sorry I keep asking these, I wish we had better search functions or TOCs. When I search for this, I keep finding things about character expression code.

I'm dead certain I saw someone post a very nice "blinking" effect a month or so ago, in the Cookbook, Creator Discussion, or Ren'Py Questions, I forget. The kind where it simulates a first-person human eye? I'm looking for a nice effect like that for Queen.

To be clear, I mean something like this: http://www.youtube.com/watch?v=bhVDvl7GxZI

More detailed search with better terms, I'm finding some stuff:

First-person blinking effect? - Lemma Soft Forums (2)

Top

Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Contact Asceai

Send private message

Re: First-person blinking effect?

  • Quote

#2Postby Asceai »

Use an ImageDissolve transition. Multiply a vertical 0->1->0 gradient with a circular 0->1 gradient for your control image, then transition to / from black. The eye open animation should have reverse=False, the eye close animation should have reverse=True.

Top

Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Contact Asceai

Send private message

Re: First-person blinking effect?

  • Quote

#3Postby Asceai »

It's a pretty hard effect to get quite right, but here is my attempt, just to give you a general idea. Someone not as inept at image manipulation would probably do a 10x better job.

Code: Select all

init python: def eyewarp(x): return x**1.33 eye_open = ImageDissolve("eye.png", .5, ramplen=128, reverse=False, time_warp=eyewarp) eye_shut = ImageDissolve("eye.png", .5, ramplen=128, reverse=True, time_warp=eyewarp)image black: Solid("#000")image white: Solid("#FFF")label start: scene black "Asleep" scene white with eye_open "Awake" scene black with eye_shut "Asleep" return
Attachments

Top

Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Contact Asceai

Send private message

Re: First-person blinking effect?

  • Quote

#4Postby Asceai »

Played around some more- this one is a little better:

Attachments

Top

Rosstin2
Veteran
Posts: 253
Joined: Thu Jan 09, 2014 12:42 pm
Completed: King's Ascent, Kitty Love
Projects: Queen At Arms, Rex Rocket
Organization: Aqualuft Games
Contact:

Contact Rosstin2

Send private messageWebsite

Re: First-person blinking effect?

  • Quote

#5Postby Rosstin2 »

Wow, this is really good, Asc!

I meant to delete this topic after I necroed the other one... sorry forum gods ^_^;

First-person blinking effect? - Lemma Soft Forums (6)

Top

crimsonnight
Veteran
Posts: 299
Joined: Fri Apr 20, 2012 4:44 am
Contact:

Contact crimsonnight

Send private message

Re: First-person blinking effect?

  • Quote

#6Postby crimsonnight »

Asceai wrote:It's a pretty hard effect to get quite right, but here is my attempt, just to give you a general idea. Someone not as inept at image manipulation would probably do a 10x better job.

Code: Select all

init python: def eyewarp(x): return x**1.33 eye_open = ImageDissolve("eye.png", .5, ramplen=128, reverse=False, time_warp=eyewarp) eye_shut = ImageDissolve("eye.png", .5, ramplen=128, reverse=True, time_warp=eyewarp)image black: Solid("#000")image white: Solid("#FFF")label start: scene black "Asleep" scene white with eye_open "Awake" scene black with eye_shut "Asleep" return

Sorry, I know this topic is old - I'd love to use this effect in my game but I'm getting the following error when trying to use this code:

Code: Select all

I'm sorry, but errors were detected in your script. Please correct theerrors listed below, and try again.File "game/script.rpy", line 153: expected an indented block return x**1.33 ^ Ren'Py Version: Ren'Py 6.99.12.1912

How do I correct it?

alwaysthesamebluesky.com

Top

Donmai
Eileen-Class Veteran
Posts: 1964
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Contact Donmai

Send private message

Re: First-person blinking effect?

  • Quote

#7Postby Donmai »

As the error is telling you. Check the indentation. Asceai's example code uses two spaces for indentation. It works, but if you mix it with another piece of code that uses a different indentation, you may have problems. Try 4-spaces indentation, for example:

Code: Select all

init python: def eyewarp(x): return x**1.33 eye_open = ImageDissolve("eye.png", .5, ramplen=128, reverse=False, time_warp=eyewarp) eye_shut = ImageDissolve("eye.png", .5, ramplen=128, reverse=True, time_warp=eyewarp)image black: Solid("#000")image white: Solid("#FFF")label start: scene black "Asleep" scene white with eye_open "Awake" scene black with eye_shut "Asleep" return

Does it work for you?
BTW, if you want to use this effect to simulate someone falling asleep and awakening, it would be better to change the .5 value to something like 1.0 or 2.0.

No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

Top

crimsonnight
Veteran
Posts: 299
Joined: Fri Apr 20, 2012 4:44 am
Contact:

Contact crimsonnight

Send private message

Re: First-person blinking effect?

  • Quote

#8Postby crimsonnight »

Donmai wrote:As the error is telling you. Check the indentation. Asceai's example code uses two spaces for indentation. It works, but if you mix it with another piece of code that uses a different indentation, you may have problems. Try 4-spaces indentation, for example:

Code: Select all

init python: def eyewarp(x): return x**1.33 eye_open = ImageDissolve("eye.png", .5, ramplen=128, reverse=False, time_warp=eyewarp) eye_shut = ImageDissolve("eye.png", .5, ramplen=128, reverse=True, time_warp=eyewarp)image black: Solid("#000")image white: Solid("#FFF")label start: scene black "Asleep" scene white with eye_open "Awake" scene black with eye_shut "Asleep" return

Does it work for you?
BTW, if you want to use this effect to simulate someone falling asleep and awakening, it would be better to change the .5 value to something like 1.0 or 2.0.

Thanks, I think I was being an idiot, I've got it working now... only it isn't what I hoped for. There doesn't seem to be any actual blinking First-person blinking effect? - Lemma Soft Forums (9)
My aim is to create an effect of someone blinking rapidly a few times, for example after being exposed to a bright light - maybe I should start a new thread?

alwaysthesamebluesky.com

Top

redeyedangel01
Newbie
Posts: 1
Joined: Mon May 28, 2018 7:04 pm
Contact:

Contact redeyedangel01

Send private message

Re: First-person blinking effect?

  • Quote

#9Postby redeyedangel01 »

Asceai wrote: Mon Mar 17, 2014 7:28 pmIt's a pretty hard effect to get quite right, but here is my attempt, just to give you a general idea. Someone not as inept at image manipulation would probably do a 10x better job.

Code: Select all

init python: def eyewarp(x): return x**1.33 eye_open = ImageDissolve("eye.png", .5, ramplen=128, reverse=False, time_warp=eyewarp) eye_shut = ImageDissolve("eye.png", .5, ramplen=128, reverse=True, time_warp=eyewarp)image black: Solid("#000")image white: Solid("#FFF")label start: scene black "Asleep" scene white with eye_open "Awake" scene black with eye_shut "Asleep" return

I'm aware that this thread is super old but i was wondering if i might have your permission in using this code for my game?
I just starting learning renpy recently.
and if on the off-chance that i make profit off of my game in the future i really need your permission to use the code before i can use it in good faith.

Top

richycapy
Regular
Posts: 56
Joined: Mon May 27, 2019 8:53 pm
Organization: EN Productions
Location: Mexico
Contact:

Contact richycapy

Send private messageTwitter

Re: First-person blinking effect?

  • Quote

#10Postby richycapy »

Amazing animation!! Congrats!!

Top

Treladon
Regular
Posts: 40
Joined: Sat Dec 31, 2016 3:20 pm
Projects: ToMaG, Feinted Game
Organization: Kuehler-Corrada Productions
Deviantart: Journie
Contact:

Contact Treladon

Send private message

Re: First-person blinking effect?

  • Quote

#11Postby Treladon »

I know it's been a while since this was posted, but for anyone who ends up here (like I did) I wanted to post what I ended up doing as well. Another option if you like.

I wanted to player to see main character blinking a few times over the background (like they're waking up, trying to clear their vision, etc.), so what I did was add a blank png to my images folder as well as this half-closed eye background attached (a plain black background will do basically the same thing).

*Not sure if this attached png will actually have any transparency on LemmaSoft, so you may have to make your own.

Then I created this transform:

Code: Select all

transform blink: "eye.png" alpha 1.0 .1 alpha 0.0 .2 alpha 1.0 .1 alpha 0.0 .7 alpha 1.0 .1 alpha 0.0 

I added the blank png as a background image at the beginning of the script:

Code: Select all

image blank = "blank.png"

Then every time I want the player to blink a few times, I write:

Code: Select all

show blank at blink

WIP: The Tasks of Messengers and Guardians - Progress Page Here!

Top

nyeowmi
Newbie
Posts: 5
Joined: Thu Oct 27, 2022 11:10 pm
Projects: Never Ending Love
Discord: nyeowmi#6969
Contact:

Contact nyeowmi

Send private message

Re: First-person blinking effect?

  • Quote

#12Postby nyeowmi »

Sorry to like reawaken this topic since it's pretty much dead but I figured out a smoother way of making the blink transition work?

First-person blinking effect? - Lemma Soft Forums (14)

Basically took treladon's idea and made it complicated loool but what I did was have three images instead of one: eye closed, eye half open and eye open. (Figured posting it on imgur would keep the transparency)

That's the only difference loool but it ended up looking exactly how I wanted it and it felt smoother too. I included two codes: one for the long blink that I use in my game and the second one is a short blink you can have repeat as many times as you want.

Code: Select all

transform blink: "eye-half.png" .1 "eye-close.png" .1 "eye-opehn.png" .2 "eye-half.png" .1 "eye-close.png" .1 "eye-opehn.png" .2 "eye-half.png" .1 "eye-close.png" .1 "eye-opehn.png" alpha 0.0

Code: Select all

 "eye-half.png" .1 "eye-close.png" .1 "eye-opehn.png" alpha 0.0

You would basically call it the same exact way treladon put in their reply!

Top

Post Reply

  • Print view

12 posts• Page 1 of 1

Return to “Ren'Py Questions and Announcements”

Who is online

Users browsing this forum: Bing [Bot]

First-person blinking effect? - Lemma Soft Forums (2024)
Top Articles
Latest Posts
Recommended Articles
Article information

Author: Sen. Ignacio Ratke

Last Updated:

Views: 6214

Rating: 4.6 / 5 (76 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Sen. Ignacio Ratke

Birthday: 1999-05-27

Address: Apt. 171 8116 Bailey Via, Roberthaven, GA 58289

Phone: +2585395768220

Job: Lead Liaison

Hobby: Lockpicking, LARPing, Lego building, Lapidary, Macrame, Book restoration, Bodybuilding

Introduction: My name is Sen. Ignacio Ratke, I am a adventurous, zealous, outstanding, agreeable, precious, excited, gifted person who loves writing and wants to share my knowledge and understanding with you.