show_animation()
- 1 Minute to read
show_animation()
- 1 Minute to read
Article summary
Did you find this summary helpful?
Thank you for your feedback
This function displays an animation component.
The animation component provides an animated screen and is used to display information about some process/flow, without asking feedback from the user. The component can be used for example to provide a loading screen, display a visual of the robot performing or about to perform a task.
Reference
Explore more about this component here
Arguments
Arguments | Type | Default Value | Description |
---|---|---|---|
path | str | None | Path of an existing file |
lottie | str | None | Lottie file |
url | str | None | Url of the image to show |
This component allows you to use a kwargs for the styling of the component this arguments are
Arguments | Type | Default Value | Description |
---|---|---|---|
title | string | Title of the modal (mandatory) | |
title_size | enum | UI_TITLE_SIZE.MEDIUM | Size of the title |
subtitle | string | Subtitle of the modal (optional) | |
content | Any | None | Data based on chosen format type. If 'LOTTIE', fill with JSON data, if GIF, JPEG, or PNG, fill with base64 string. If 'URL', fill with URL string. |
format | enum | None | Indicates the format of the content, check UI_ANIMATION_TYPE |
show_loader | bool | False | show loader on screen |
show_back_button | bool | False | Show a button to go back |
back_button_text | string | "Back" | Text of the back button |
button_size | int | 1 | Button size (1 = SMALL, 2 = MEDIUM, 3 = LARGE) |
languages | list | None | List of languages to be displayed on the screen (optional) |
chosen_language | str | None | If list given, string representing chosen language |
theme | enum | UI_THEME_TYPE.DARK | Enum to define the theme of the screen, check UI_THEME_TYPE |
custom_style | dict | None | Dictionary containing custom styles for the modal (optional) |
Return
None
Exceptions
RayaUIMissingValue
RayaUIInvalidValue
RayaApplicationException
See the complete list of ui exceptions and the complete list of general exceptions.
Example
How to load and display a lottie file. Note: need to have a valid lottie file in arrow1.json.
IMAGE_ARROW_PATH = 'res:arrow1.json'
class RayaApplication(RayaApplicationBase):
async def setup(self):
self.UI = await self.enable_controller('ui')
....
async def loop(self):
....
self.log.info(f'Displaying {IMAGE_ARROW_PATH} animation')
await self.UI.show_animation(
title = 'This is a bridge with a forest',
subtitle='This a lottie file',
lottie = IMAGE_ARROW_PATH
)
...
async def finish(self):
...
...
Was this article helpful?