display_animation()
  • 1 Minute to read

display_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
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

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):
     ....
        arrow_anim = json.load(open_file(IMAGE_ARROW_PATH))

        await self.UI.display_animation(
            title = 'Go there',
            subtitle='This is a Lottie file',
            content = arrow_anim, 
            format= UI_ANIMATION_TYPE.LOTTIE
        )
      ...
      
    async def finish(self):
      ...

...

Was this article helpful?