API:WindowStartAlphaAnimation
From RoR Wiki
UI Lua API · Window functions
Version: WAR 1.4.8
Starts an animation of a window's alpha (opacity).
WindowStartAlphaAnimation(windowName, animationType, startAlpha, endAlpha, duration, setStartBeforeDelay, delay, loopCount)
Arguments
- windowName
string– Name of the window.- animationType
number– How the value changes over time. Use aWindow.AnimationTypeconstant (see below).- startAlpha
number– Alpha at the start of the animation.- endAlpha
number– Alpha at the end of the animation.- duration
number– Length of one pass fromstartAlphatoendAlpha, in seconds.- setStartBeforeDelay
boolean–trueto applystartAlphastraight away, during the delay. Withfalse, the window keeps its current alpha until the delay is over.- delay
number– Seconds to wait before the animation starts.- loopCount
number– ForLOOPandREPEAT: how many passes to run before the animation ends. 0 runs until it is stopped. Ignored by the other types.
Returns
Nothing.
Details
- Animation types:
| Constant | Value | Behaviour |
|---|---|---|
Window.AnimationType.SINGLE |
1 | Linear change from start to end, once. Then the window's alpha goes back to the value it had before the animation. |
Window.AnimationType.SINGLE_NO_RESET |
2 | Linear change from start to end, once. The end value stays. |
Window.AnimationType.SINGLE_NO_RESET_HIDE |
3 | Like SINGLE_NO_RESET, and the window is hidden when the animation finishes.
|
Window.AnimationType.EASE_OUT |
4 | Change from start to end along (time / duration)², so slow at first and fast at the end, once. The end value stays. |
Window.AnimationType.EASE_OUT_HIDE |
5 | Like EASE_OUT, and the window is hidden when the animation finishes.
|
Window.AnimationType.LOOP |
6 | Linear back and forth: start to end, then back to start. One loop takes twice duration. When it ends, the original alpha is restored.
|
Window.AnimationType.REPEAT |
7 | Linear from start to end, then jumps back to start and repeats. When it ends, the original alpha is restored. |
Window.AnimationType.POP |
8 | A special curve. When it ends, the original alpha is restored. |
Window.AnimationType.POP_AND_EASE |
9 | A special curve. When it ends, the original alpha is restored. |
- Each frame the animated value is written to both the window's alpha and its font alpha, so the text fades too. Child windows follow as with WindowSetAlpha and WindowSetFontAlpha.
- "Original alpha" means the window's alpha and font alpha at the moment the animation was started. Types 1 and 6–9 restore them both when they finish and when they are stopped with WindowStopAlphaAnimation. Types 2–5 leave the current value in place.
- The hiding of types 3 and 5 happens only when the animation finishes by itself, not when it is stopped.
- A window has at most one alpha animation. Starting a new one stops the old one first, including its reset.
- If both
durationanddelayare 0, the animation is finished immediately without applyingendAlpha. animationTypeandloopCountare truncated to whole numbers.easystem_windowutils/source/frame.luapassesfalseforsetStartBeforeDelayin a variable namedunsupportedParameter, with the comment that it "does not appear to be used". The client does use it as described above.- There is no lock check in this function.
Errors
Error in function call 'WindowStartAlphaAnimation': Window %s does not exist
Example
A pulsing buff icon, from eatemplate_unitframes/source/bufftracker.lua:
WindowStartAlphaAnimation( self:GetName(), Window.AnimationType.LOOP, 1, 0.5, 1, true, 0, 0 )
Fading out combat text after a delay, from easystem_eventtext/source/system_eventtext.lua:
WindowStartAlphaAnimation( newEventFrame:GetName(), Window.AnimationType.EASE_OUT,
1, 0,
animationData.fadeDuration, false, animationData.fadeDelay, 0 )
