Fading Textures
I would like to fade a texture in, and then out, like a splash - I did it a while ago but cannot remember how. Doesn't have something to do with animation?
Please advise. I added the Lua below for reference, I am really unsure how to get this to fade in/out. (edit) Lua Code:
This makes the Logo not visible but does not fade. Perhaps it does fade but is immediate? |
UIFrameFadeIn()/Out() maybe? I use that in place of :Show()/:Hide() and it seems to work nicely.
Lua Code:
|
Quote:
Lua Code:
Ok, so this is what I have so far in the goal to fade in/out the splash minus that part. This part is trying to set a per character variable to 1. On 1 or below, the splash shows, 2 or higher - it doesn't. I don't want the splash / install to pop up on every loading screen / reloadui. |
This is the frame fader I use in rLib which is using animations.
https://github.com/zorker/rothui/blo...framefader.lua Example call from one of my addons: https://github.com/zorker/rothui/blo...r/core.lua#L48 If you need an example for a drag frame you can check rLib too. https://github.com/zorker/rothui/blo.../dragframe.lua https://github.com/zorker/rothui/blo.../core.lua#L107 |
Quote:
|
Quote:
|
If you only want it to show up on the first time you log in ...
PlayerEnteringWorld has two parameters. firstTimeLogin, reload If the first parameter is true then it is the first time you have logged into the game and can show the splash. Now, if you also only want it to show up if it is the first time that version of the addon has been run, to show say update notes, then you could then have an account or character specific SavedVariable setting that holds the last version number loaded and then only display if that value is different from the one now running. Then after the frame is displayed update the saved variable. Something like the following Lua Code:
|
I can't see you calling :Play() anywhere in your code. Animations don't run automatically.
Lua Code:
|
Quote:
Lua Code:
|
Quote:
|
Quote:
|
Quote:
|
rLib is a library addon that has generic functions used by many of my addons.
|
Quote:
|
Quote:
sv.version is just an example of variable ( item in the savedvariable table) connected to the sv value which is just what I put to show that you use your savedvariable table in place of sv. addon.version is a similar thing but is just pointing to a variable in your addon code holding a copy of your addon version which can be retrieved using GetAddOnMetadata function as the following example shows. <...> shows what has to be replaced with what is your addon's equivalent Lua Code:
You may also get away with using PLAYER_LOGIN which should only happen the first time you log in. But it would depend on what information you need and its availability at that time. PLAYER_ENTERING_WORLD tends to be the event used for this reason so thankfully they have added those two parameters to the event to make things easier to identify between a fresh login and a reload/loading screen. I hope that helps make a bit more sense of what I was trying to explain. |
It does Xrystal. Thank you, I will try and get it working.
|
Quote:
Lua Code:
So if I wrote it like this it would get the addon version when loaded. Compare it to the saved variable with is in PawDB - Then show the splash if it didn't equal 2. Then make it equal 2? Headaches are the worst for learning. EDIT - fixed my code. PawsUI.lua inside saved variables still shows PawDB = nil |
You have to initialise your saved variables .. by default they will be nil.
Near the top of your addon's lua file you need set the base values -- This will create a new table containing no values <SavedVariablePerCharacterTable> = {} -- This will set the version variable to nil so that the first test will cause the splash to appear. <SavedVariablePerCharacterTable>.version = nil By the time PLAYER_ENTERING_WORLD is called your saved variables should be loaded in memory So, using your example you posted this is how I would code it. See how this works out for you. Login a few times without changing the Version field in the TOC and then a few times after changing it ... the splash should only appear after it is changed. Lua Code:
|
I literally tried that code as shown and the splash does not show. I am unsure why. I am really sorry to bother you guys with this.
Any idea why? I changed the version numbers around in the toc. |
Just noticed, you haven't given your frame a visual presence. You need to give it a backdrop or background texture/color to visually see it. However, using /framestack will allow you to see where it would be if it was viewable. :)
I'll just code up a quick mini addon to make sure it does do what I expect and then I'll post it up for you. Edit: Spotted some other boo boos so will rig up a quick and dirty version for you to use as an example :) |
All times are GMT -6. The time now is 09:48 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI