Page 1 of 1

Help please - Trying to get a simple blink animation to work

Posted: Thu Mar 29, 2018 11:34 pm
by willanik
Hi,

I want to make a simple animation by alternating between two or three images, for example like the blinking character in this video - https://www.youtube.com/watch?v=iixZ4CnswzY
But I cannot get it to work!

I have set up a simple trial. I have added images 1 and 2 to my image file as pngs. They are sized to fit the screen. Then, as per the video, I have coded as follows:

Code: Select all

image 1 = "1.png"
image 2 = "2.png"

# animation

image blink:
     "1.png"
      2
      "2.png"
      0.2
      repeat 
    
# The game starts here.

label start:

    scene background 

    pause

    show blink

    return
The result is that on Start Game my background comes up as expected, but when I hit Enter I just go back to the main menu. The blink images do not come up.

Any ideas what I am doing wrong? Or, happy to be shown a link to an alternate way of making a simple animation.
Many thanks for any help you can provide!

Re: Help please - Trying to get a simple blink animation to work

Posted: Fri Mar 30, 2018 12:04 am
by Donmai
Your image is showing but you don't have enough time to see it before it disappears in a blink (sorry, couldn't resist).
Add another pause or a line of dialogue after showing the image (even a blank dialogue line will do) to make the program wait for an user action. That should give you time to see the image.

Code: Select all

label start:

    scene background 

    pause

    show blink
    "Is it blinking?"

    return

Re: Help please - Trying to get a simple blink animation to work

Posted: Fri Mar 30, 2018 1:21 am
by willanik
Fantastic! Thanks Donmai.
I made your change and it was fixed in the blink of en eye!

Re: Help please - Trying to get a simple blink animation to work

Posted: Fri Mar 30, 2018 2:44 pm
by Donmai
:lol: I'm glad I could help.

Re: Help please - Trying to get a simple blink animation to work

Posted: Thu May 03, 2018 8:08 pm
by willanik
Ok, so my blink works! Now I am moving on to having a character wave his arm. I can write the code to make the waving animation (as below), but the result looks very jerky.

image waving:
"01.jpg"
0.2
"02.jpg"
0.2
"03.jpg"
0.2
"04.jpg"
0.2
"03.jpg"
0.2
"02.jpg"
0.2
repeat

Is there any additional code I can use to smooth out the transitions? Thanks for any help you can give me!

Re: Help please - Trying to get a simple blink animation to work

Posted: Fri May 04, 2018 4:52 am
by kivik
Human eye blinking is so fast that you barely ever noticed that you've blinked - hence the expression at the blink of an eye - it's perceivably just your eyes going from opened to closed and back to opened again, that's why a few frames work.

Hand waving on the other hand, is much slower, so unless you're waving it inhumanly fast, you'd need a lot more frames to make it smooth looking - consider films are shown at 24 frames per second, phone videos and consoles at 30fps, PC games and newer consoles at 60fps - your 5fps animation will inevitably be jerky.

You've got a few options - one is to actually go the opposite way - and go for 2 frames > starting and ending frame. I'm sure may NVL games does that to indicate a character's physical motions. This is the path I'd recommend

Two, is to try using the rotate property: https://www.renpy.org/doc/html/atl.html ... rty-rotate. I will most likely look very weird though, at best it'd look like puppetry.

Three, is to create more frames in between - but there's something else to also bear in mind - even at 24fps with still frames, your waving motion will still look odd: films and videos aren't just showing at their specific frame rate, they're also shot at the same frame rate, which means motion blur is introduced to smooth out the picture. That's why you can't shoot a video at 60fps and convert it to 24fps easily.
When Matrix first did bullet time, they had to do computer to digitally introduce frame blending because no motion blur were introduced to the frames, as they used lots of still cameras. You can actually notice the distortion if you watch it carefully.


TLDR; use 2 frames and longer pause in between is your best option :)

Re: Help please - Trying to get a simple blink animation to work

Posted: Sun May 06, 2018 7:19 pm
by willanik
Thanks Kivik, good information.

I guess I was also hoping that I could add some code to blur the transition between images. A bit like 'with dissolve' can do in other situations.

Re: Help please - Trying to get a simple blink animation to work

Posted: Sun May 06, 2018 9:11 pm
by kivik
You can add dissolve to your animation, it still won't come out like waving as it won't blur the movement, but it's probably a good option.

Here's an example of adding dissolve in an animation https://www.renpy.org/doc/html/atl.html ... -statement

Combine it with repeat x for just the first and last frame should work.

Re: Help please - Trying to get a simple blink animation to work

Posted: Mon May 07, 2018 12:47 am
by willanik
Thanks again, I'll read through the info on that link and do some experimenting!