1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
--[[
A utility object that wraps alpha animation behavior. This makes it easier
to control fade in and fade out on a single control that may need to stop or restart
an animation before it fully finishes. Rather than making local variables to represent
the different animations that could play on the control, this allows you to wrap the control
and just call FadeIn, FadeOut on this object...internally the ZO_AlphaAnimation object
tracks its own state so it knows which animations to stop or reuse, and knows the current
alpha of the control being managed.
Here are some usage notes:
- Simple utility to play a one-shot animation on a control.
- The control is force-shown before the animation starts, and its alpha can be forced to 1.
- The control is NOT hidden when the fade out completes...we can add that if necessary
- ...and along those lines: after the animation has completed the control REMAINS SHOWN and the animation is released.
NOTE: The alpha animations can be told to use the Control's current alpha, rather than forcing it to 1 or 0 before
beginning the animation. This will also scale the duration of the animation appropriately. For example, let's say
the Control has alpha .25 and we want to play a fade out with a duration of 2 seconds. Setting the fade option to
ZO_ALPHA_ANIMATION_OPTION_USE_CURRENT_ALPHA will cause the animation to last .5 seconds and fade from .25 to 0 alpha.
--]]
local ALPHA_OPAQUE = 1
local ALPHA_TRANSPARENT = 0
-- The callback is called after releasing the animation and resetting the control so that it can actually spawn another
-- animation if necessary. The animation is not passed in because it has already been released.
end
end
ZO_ALPHA_ANIMATION_OPTION_USE_CURRENT_ALPHA = 1
ZO_ALPHA_ANIMATION_OPTION_FORCE_ALPHA = 2
ZO_ALPHA_ANIMATION_OPTION_USE_CURRENT_SHOWN = 1
ZO_ALPHA_ANIMATION_OPTION_FORCE_SHOWN = 2
local function InitializeAnimationParams ( control , delay , duration , fadeOption , shownOption , forcedAlpha )
delay = delay or 0
duration = duration or 1
if ( fadeOption == ZO_ALPHA_ANIMATION_OPTION_FORCE_ALPHA )
then
currentAlpha = forcedAlpha
end
if shownOption == ZO_ALPHA_ANIMATION_OPTION_FORCE_SHOWN
then
end
return delay , duration , currentAlpha
end
--[[
Interface to obtain the animation object that is linked to the control
--]]
end
if ( animatedControl )
then
a . m_animatedControl = animatedControl
a . m_fadeTimeline = nil
a . minAlpha = ALPHA_TRANSPARENT
a . maxAlpha = ALPHA_OPAQUE
-- Link the control to this animation object
animatedControl . m_fadeAnimation = a
end
return a
end
return self . m_animatedControl
end
self . minAlpha = minAlpha
self . maxAlpha = maxAlpha
end
ZO_ALPHA_ANIMATION_OPTION_PREVENT_CALLBACK = 1
if ( self . m_fadeTimeline )
then
if ( stopOption == ZO_ALPHA_ANIMATION_OPTION_PREVENT_CALLBACK )
then
end
end
end
if ( self . m_fadeTimeline )
then
end
return false
end
if self . m_fadeTimeline then
else
local fade
return fade
end
end
fadeOption = fadeOption or ZO_ALPHA_ANIMATION_OPTION_USE_CURRENT_ALPHA
shownOption = shownOption or ZO_ALPHA_ANIMATION_OPTION_FORCE_SHOWN
local currentAlpha
delay , duration , currentAlpha = InitializeAnimationParams ( control , delay , duration , fadeOption , shownOption , self . minAlpha )
end
fadeOption = fadeOption or ZO_ALPHA_ANIMATION_OPTION_USE_CURRENT_ALPHA
shownOption = shownOption or ZO_ALPHA_ANIMATION_OPTION_FORCE_SHOWN
local currentAlpha
delay , duration , currentAlpha = InitializeAnimationParams ( control , delay , duration , fadeOption , shownOption , self . maxAlpha )
end
end
end
end
end |