Animation Looping
Here is the animation looping control flag descriptions. The loop control allows to set start/end frames for the first iteration of the loop and start/end frames for all other iterations in the loop.
Animations
The following apply to any animation:
- Start defines a 0-based index of the first frame to play on the first iteration.
- Start is used for first iteration irrespective of the number of total iterations defined for this animation. Start defaults to 0 if not defined.
- End defines the number of frames starting from the frame number specified by Start(0-based). So when Start=0, you can consider End as the frame index(1-based) of the ending.
- it could be the shadow frames as well unless Shadow=yes is set in RA2/YR making it to end with the last normal frame.
- LoopCount defines the total amount of iterations to play.
- Value 1 is for a single iteration where the LoopStart and LoopEnd values are not used instead.
- Value ≥ 2, then the following two tags will be used:
- Value -1 is used for infinite loop.
Notes (0-based)
None loop :
Start -> Start+End -1
Have loop (0-based):
Start -> LoopEnd-1 -- [LoopCount-1 times] --><-> LoopStart -> Start+End -1
- If Start ≥ LoopEnd-1, animation will only play 1 frame using the index specified by Start and then directly enter the second Loop;
- If LoopStart ≥ LoopEnd - 1, then display 1 frame of LoopStart, and then proceed to the next Loop.
- If Start+End -1 ≤ LoopStart, animation will only play 1 frame using the index specified by LoopStart and then end.
From 2 to 10, there are 9 numbers instead of 10-2=8. And 10=2+9-1.
- This is obvious, so you need to -1 at the end to get the frame index.
Notes (1-based)
None loop (1-based):
Start+1 -> Start+End (← Start+1 + End -1)
Have loop (1-based):
Start+1 -> LoopEnd -- [LoopCount-1 times] --><-> LoopStart+1 -> Start+End (← Start+1 + End -1)
- If Start+1 ≥ LoopEnd, animation will only play 1 frame using the index specified by Start+1 and then directly enter the second Loop;
- If LoopStart + 1 ≥ LoopEnd, then display 1 frame of LoopStart + 1, and then proceed to the next Loop.
- If Start+End ≤ LoopStart+1, animation will only play 1 frame using the index specified by LoopStart+1 and then end.
From 2 to 10, there are 9 numbers instead of 10-2=8. And 10=2+9-1.
- This is obvious, so you need to -1 at the end to get the frame index.
Bugs/Side-Effects/Unexpected Limitations
If an animation of a Loop is used by another animation via Next, then its Start will be calculated by multiplying by 2.
- For example, the following code will make RING1 and PDFXLOC both stay for 2 frames at frame 11 (1-based) of the Shape before swapping.
- However, if RING1 or PDFXLOC are created using AnimList, the first playback will start from frame 6 (1-based).
[AnyAnim] Next=RING1 [RING1] Start=5 LoopStart=10 LoopEnd=11 End=6 LoopCount=2 Next=PDFXLOC [PDFXLOC] Start=5 LoopStart=10 LoopEnd=11 End=6 LoopCount=2 Next=RING1
That is,
- Start*2 -> LoopEnd-1 -- [LoopCount-1 times] --> LoopStart+0 -> Start+End-1 for 0-based index;
- Start*2+1 -> LoopEnd -- [LoopCount-1 times] --> LoopStart+1 -> Start+End-0 for 1-based index.
Correspondingly, this causes you to be unable to stably play even-numbered (1-based) frames.
- For example, you cannot stably use the 10th (1-based) frame for the above RING1 and PDFXLOC, because Start will insert an odd-numbered (1-based) frame.
Projectiles
Animated projectiles have their own set of flags which achieve the same effect as the loop flags above, albeit with somewhat less control.
- AnimLow defines a 0-based index of the first frame.
- AnimHigh defines a 0-based index of the last frame.
The animation will loop indefinitely until the projectile expires in one way or another.