View Single Post
02/20/23, 06:01 AM   #8
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
You almost got it right. Instead of GetControl(image, "/esoui/art/screens_app/load_ourosboros.dds") you need to pass the image to it directly though.
GetControl is used to get a control by name, so passing a texture path to it doesn't make any sense.
Lua Code:
  1. local image = WINDOW_MANAGER:CreateControl("TeleportHourglassImage", hourglass, CT_TEXTURE) -- do not forget to make it local, otherwise it may overwrite a global variable and mess things up for the ingame ui or other addons!
  2. image:SetAnchorFill(hourglass)
  3. image:SetTexture("/esoui/art/screens_app/load_ourosboros.dds") -- no point in doing that via the global variable when you already have it locally
  4. hourglass.animation = ANIMATION_MANAGER:CreateTimelineFromVirtual("LoadIconAnimation", image)

You don't have to mess with xml if you do not want to do that yet. You can just use the existing animation templates.
It's also possible to modify them in Lua once you created it, but I don't really recommend it, as it's bad for long-term maintainability of your addon.
Lua Code:
  1. hourglass.animation:GetFirstAnimation():SetDuration(3000) -- set it to 3s
Simply defining the whole animation template in XML is much better in that regard.


EDIT: you should also take care to make your variables local or store them on a table your addon "owns". Otherwise you may accidentally overwrite something somewhere that is out of your scope and break stuff.

Last edited by sirinsidiator : 02/20/23 at 06:04 AM.
  Reply With Quote