API:AnimatedImageStartAnimation
From RoR Wiki
UI Lua API · AnimatedImage functions
Version: WAR 1.4.8
Starts playing an AnimatedImage.
AnimatedImageStartAnimation(imageName, startFrame, loop, hideWhenComplete, delay)
Arguments
- imageName
string– Name of an AnimatedImage window.- startFrame
number– Frame number. The stock UI always passes0. Fractions are dropped.- loop
boolean–trueto start again from the first frame after the last one,falseto play once.- hideWhenComplete
boolean–trueto hide the image when a non-looping animation ends.- delay
number– Seconds to wait before the animation starts.0starts it at once.
Returns
Nothing.
Details
- If
startFrameis greater than the number of frames in the animation, the call does nothing. - The function does not show the window. The stock UI shows it first (see the example).
- When a non-looping animation reaches its end, it stops; with
hideWhenCompletethe image is also hidden. - The playing speed can be changed with AnimatedImageSetPlaySpeed.
loopandhideWhenCompletemust be real booleans. Passingnilor a number raises an Invalid Parameters error.- Note the wording of the second error message: it has no "Window" before the name.
Errors
Error in function call 'AnimatedImageStartAnimation': Window %s does not existError in function call 'AnimatedImageStartAnimation': %s is not an AnimatedImage
Example
A looping indicator, from ea_menubarwindow/source/menubarwindow.lua:
if ( SystemData.StreamingData.isStreaming )
then
WindowSetShowing( "StreamingIndicator", true )
WindowSetShowing( "StreamingIndicatorAnim", true )
AnimatedImageStartAnimation( "StreamingIndicatorAnim", 0, true, false, 0 )
else
AnimatedImageStopAnimation( "StreamingIndicatorAnim" )
WindowSetShowing( "StreamingIndicatorAnim", false )
WindowSetShowing( "StreamingIndicator", false )
end
A page flip that plays once after a delay and then hides itself, from ea_loadingscreen/source/standardloadingscreen.lua:
AnimatedImageStartAnimation( windowName.."PageFlipAnim", 0, false, true, animDelay )
