> 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/classes/image/playanimation.md).

# playAnimation

```lua
return function()
    local app = getApp();
    local ob = app.createGameObject(); --create object to attach images to
    applyImage(ob, 'welcomeImage'); --add the image titled 'welcome' to the object
    
    ob.image.anchor('center', true); 
    --anchors the image to the center of the screen...
    wait (0.2);
    
    ob.image.stopAnimation();
    
    wait(3);
    
    ob.image.playAnimation();
    --if the image is an animated one, it will begin animating.
    --animated images play automatically when using applyImage()
end
```

{% hint style="warning" %}
You must first create an image for it to be applied! Check applyImage below for examples.
{% endhint %}

{% content-ref url="/pages/gqvM4178o3OeR3R3fEvX" %}
[applyImage](/lua-scripting-api/api-reference-and-tips/global-functions/applyimage.md)
{% endcontent-ref %}
