# Add lip sync and blinking

> Register mouth and eye overlay images for a variant, so the mouth moves while the character speaks and the eyes blink now and then

Lip sync and blinking work by switching images laid over the sprite. You register mouth images and eye images for each variant. Nothing needs to be added to the script.

## Prepare the overlay images

For lip sync and blinking, you need images that show only the mouth or the eyes, separate from the sprite. The sample characters Akari and Sou don't include them, so prepare your own if you want to use them.

- Make PNGs the same size as the sprite image (the same width and height in pixels), with only the mouth or eyes drawn and everything else transparent. They're laid over the sprite image with their top left corners aligned.
- For lip sync, prepare a slightly open mouth, then a wide open mouth, in that order. The closed mouth of the original sprite shows through, so you don't need one.
- For blinking, prepare half-closed eyes, then closed eyes, in that order.
- One image is enough for either (just an open mouth for lip sync, or just closed eyes for blinking).
- If the mouth or eyes look different for each expression, prepare them for each variant.

An easy way to make them is to keep the sprite's layers stacked in your painting app, show only the mouth or eye layer, and export it at the same size as the sprite.

## Register the images

1. Open "Characters" at the top, and choose a character from the list on the left.
2. Under "Expressions," click a variant (here, normal), or with a variant selected, click "Lip sync and blinking."

![The Characters screen. Select a variant and click "Lip sync and blinking."](/shots/en/h-chara-lipsync-open.webp)

3. In the panel that opens below, click "＋ Add" under "Lip sync" and choose the mouth images. If there are two or more, choose them starting with the slightly open mouth.
4. Click "＋ Add" under "Blink" and choose the eye images, starting with the half-closed eyes.

![The lip sync and blinking panel. Choose images with "＋ Add."](/shots/en/h-chara-lipsync-panel.webp)

You can also add images by dragging them onto this panel. Added images are saved in the same folder as the character's images and appear as small thumbnails in the panel. Remove one with the × at its top right (the image file stays).

## How it works in the game

- The mouth moves only while the text of that character's dialogue is being displayed, and closes when the text finishes. While a voice is playing, it moves with the loudness of the voice.
- While the sprite is on screen, the eyes blink automatically every 2 to 6 seconds or so.
- If the speaker's name on dialogue lines differs from the character ID, make "Display name" on the Characters screen the same as the speaker's name. If the display name differs, the mouth doesn't move.

## In code

You don't write anything in the script. The registered images are saved in `lip` and `blink` of the variant in `cast.json` in the project folder.

```json
"normal": {
  "image": "akari/normal.webp",
  "lip": ["akari/normal_mouth1.png", "akari/normal_mouth2.png"],
  "blink": ["akari/normal_eye1.png", "akari/normal_eye2.png"]
}
```
