Builtin Library
README.md
expressions
The Expressions tab of the app menu: the expression menu the local player's
avatar declares (the menu block of its avatar.json, see
modules.avatarAnimator), drawn as rows a person works with a mouse, a finger,
the keys or a pad. Each row sets one of the avatar's parameters through its
AvatarAnimator:
- a
togglereads On while its parameter holds itsvalue, and a press sets the value or returns the parameter to its default; - a
buttonholds itsvalueforholdseconds, then returns the parameter to what it held before; - a
submenuopens itsitems, with Back (and the menu's own back) leaving it; - a
radialis a slider over one parameter frommintomax, with − and + presses either side that step a tenth of the range; - an
axisis two such sliders, one per parameter, each -1 to 1.
An avatar whose animator or menu reads the built-in Voice gets a microphone
switch at the bottom of the top page. The tab shows while the avatar it drives
declares a menu; its own words are the library catalog
locales/<tag>/expressions.json, and an item's label is the avatar's, in the
player's language when it is given per locale tag.
local expressions = require("@builtin::modules.api.engine.expressions")
appMenu.open("expressions") -- the tab in front of the person
expressions.setTarget(previewRoot.id) -- drive an avatar stood in the editor
local tree = expressions.buildBody({ presentation = "desktop", width = 800, height = 600 })
expressions.onCallback("expressions:toggle:1") -- press the first row, as a tap does
expressions.setTarget(nil) -- back to the local player's avatar
The rows are the elements expressions-<n> (the n-th item of the page shown,
<a>.<b> inside a sub-menu, -less / -more on a puppet's presses, .a1 /
.a2 for an axis puppet's two sliders), expressions-back and
expressions-microphone; gui.clickElement presses them as a person does.