Skip to main content
Trinity-2 faces take a video size and an avatar position, a camera you can move during the session, and your own backgrounds and foregrounds. Other faces ignore these options, but the session request still checks the framing fields.

Framing and starting options

Set these in SimliConfig, next to faceId. Fields left as None are left out of the request, so Simli’s defaults apply. This config starts a 16:9 session with the camera zoomed in a little:
A size that isn’t 1:1, 16:9 or 9:16, a side under 512 or a position outside 0 to 1 makes start() raise a SimliAPIError with status 422. See Framing the video for how the canvas is filled.

Changing the camera, background and foreground during a session

Once start() has returned, three methods change the avatar live:

setCamera

await connection.setCamera(camera, lerp_seconds=...) moves the camera. Each call replaces the whole camera, the session’s starting one included. Its values are offsets from the avatar’s own framing, not from the previous call, so fields you leave out are neutral, and None goes back to the avatar’s own framing. It cuts to the new camera, unless lerp_seconds is above 0: then it glides there over that many seconds, from wherever the camera is now.

setBackground and setForeground

Upload the image first, then pass the id the upload returned. setBackground(id) shows it behind the avatar, and setForeground(id) lays it over the avatar through its transparency. None goes back to the avatar’s own background, or takes the foreground away. The new image shows a moment later, once it has loaded, and if you send several, the last one wins.

Errors and notices

  • A bad value raises ValueError, and nothing is sent: a NaN or infinite camera value or lerp_seconds, or an id that isn’t the 36-character one the upload returned.
  • Simli’s notices are logged as warnings on the simli_client logger: a camera value outside its supported range (applied anyway), an id that isn’t one of your uploads, an image that couldn’t be loaded, or a face that isn’t Trinity-2. None of them end the session.
  • Once the session has ended, these methods raise as send() does.