ci / release (push) Successful in 5m5s
ci-platforms / build (amd64, windows, windows-2022) (push) Skipped
ci-platforms / build (arm64, darwin, macos-15) (push) Skipped
ci-platforms / build (amd64, darwin, macos-15-intel) (push) Skipped
ci / checks (push) Successful in 4m41s
ci / build (amd64, linux, ubuntu-24.04) (push) Successful in 7m14s
The remaining editor strings and undo step names; component, field, enum, setting, diagnostic and Script API texts under schema.*, enum.*, setting.*, diag.* and api.*; the launcher, the in-game Settings View with a Language setting, the CLI and aego schema show --lang. Every documentation page has a .ru.md translation; the site has a full Russian tree with hreflang, a language switch and ru/llms.txt; aego docs check --lang ru. New doc.tutorial and doc.recipe icons. Fix: an animator restored by a rewind prepares its controller before the replayed step.
33 lines
1.0 KiB
Markdown
33 lines
1.0 KiB
Markdown
---
|
|
id: aego/anim
|
|
summary: Имена и id событий анимации для OnAnimEvent и сигнала Event «Проигрывателя анимации».
|
|
---
|
|
|
|
Когда клип анимации доходит до события, скрипты на узле проигрывателя получают `OnAnimEvent(id int, payload float)`. События объявляются по имени в **Настройках проекта → Анимация**; `anim.EventName` и `anim.EventID` превращают id в имена и обратно. У неизвестного id имя `""`, у неизвестного имени id `-1`. См. [Анимация](ref:animation).
|
|
|
|
## Пример
|
|
|
|
```aes run
|
|
package demo
|
|
|
|
import (
|
|
"aego/anim"
|
|
"aego/log"
|
|
)
|
|
|
|
script Listener {
|
|
var hit int
|
|
|
|
func Ready() {
|
|
hit = anim.EventID("Hit")
|
|
log.Info("Hit has the id " + string(hit) + ", id 0 is called '" + anim.EventName(0) + "'")
|
|
}
|
|
|
|
func OnAnimEvent(id int, payload float) {
|
|
if id == hit {
|
|
log.Info("hit for " + string(payload))
|
|
}
|
|
}
|
|
}
|
|
```
|