> For the complete documentation index, see [llms.txt](https://docs.streamavatars.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/waitforanimation.md).

# waitForAnimation

```lua
return function()

    local app = getApp();
    
    local ob = app.createGameObject(); --create object to attach images to
    
    --add the image titled 'welcomeImage' to the object
    applyImage(ob, 'welcomeImage'); 
    
    ob.image.anchor('bottom left', true); --anchors the image to the bottom left... accounting for image dimensions = true
    
    waitForAnimation(ob.image); --pauses script until finished...
   
    applyImage(ob, 'byeImage');
    
    waitForAnimation(ob.image); --pauses script again until byeImage finished animating
    log('finished playing two animations!');
end
```
