show_animation()
  • 1 Minute to read

show_animation()


Article summary

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

image.png

Explore more about this component here

Arguments

ArgumentsTypeDefault ValueDescription
pathstrNonePath of an existing file
lottiestrNoneLottie file
urlstrNoneUrl of the image to show

This component allows you to use a kwargs for the styling of the component this arguments are

ArgumentsTypeDefault ValueDescription
titlestringTitle of the modal (mandatory)
title_sizeenumUI_TITLE_SIZE.MEDIUMSize of the title
subtitlestringSubtitle of the modal (optional)
contentAnyNoneData 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.
formatenumNoneIndicates the format of the content, check UI_ANIMATION_TYPE
show_loaderboolFalseshow loader on screen
show_back_buttonboolFalseShow a button to go back
back_button_textstring"Back"Text of the back button
button_sizeint1Button size (1 = SMALL, 2 = MEDIUM, 3 = LARGE)
languageslistNoneList of languages to be displayed on the screen (optional)
chosen_languagestrNoneIf list given, string representing chosen language
themeenumUI_THEME_TYPE.DARKEnum to define the theme of the screen, check UI_THEME_TYPE
custom_styledictNoneDictionary 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?

What's Next