Animation Looping: Difference between revisions
EvilRenegade (talk | contribs) m Replacing Template:TTL with Template:F. |
m Accurate boundary value |
||
(7 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
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]]: | |||
* {{f|Start|link}} defines a ''0-based'' index of the first frame to play on the first iteration. | * {{f|Start|link}} defines a ''0-based'' index of the first frame to play on the first iteration. | ||
* {{f|End|link}} defines the | ** Start is used for first iteration irrespective of the number of total iterations defined for this animation. Start defaults to 0 if not defined. | ||
* {{f|End|link}} defines the number of frames starting from the frame number specified by {{tt|Start}}(0-based). So when {{f|Start|0|link}}, you can consider {{tt|End}} as the frame index(1-based) of the ending. | |||
** it could be the shadow frames as well unless {{f|Shadow|yes|link}} is set in RA2/YR making it to end with the last normal frame. | |||
* {{f|LoopCount|link}} defines the total amount of iterations to play. | * {{f|LoopCount|link}} defines the total amount of iterations to play. | ||
** Value {{tt|1}} is for a single iteration where the {{tt|LoopStart}} and {{tt|LoopEnd}} values are not used instead. | |||
** Value {{tt|≥ 2}}, then the following two tags will be used: | |||
*** {{f|LoopStart|link}} defines a '''''0'''-based'' index of the first frame for loop iterations. | |||
*** {{f|LoopEnd|link}} defines a '''''1'''-based'' index of the last frame when total number of iterations is more than one. | |||
** Value {{tt|-1}} is used for infinite loop. | |||
== Notes (0-based) == | |||
None loop : | |||
{{f|Start|link}} -> {{tt|Start+}}{{f|End|link}} {{tt|-1}} | |||
Have loop (0-based): | |||
{{f|Start|link}} -> {{f|LoopEnd|link}}{{tt|-1}} -- [{{f|LoopCount|link}}-1 times] --><-> {{f|LoopStart|link}} -> {{tt|Start+End}} {{tt|-1}} | |||
*If {{tt|Start}} ≥ {{tt|LoopEnd-1}}, animation will only play {{tt|1}} frame using the index specified by {{tt|Start}} and then directly enter the second Loop; | |||
*If {{tt|LoopStart}} ≥ {{tt|LoopEnd - 1}}, then display 1 frame of {{tt|LoopStart}}, and then proceed to the next Loop. | |||
*If {{tt|Start+End -1}} ≤ {{tt|LoopStart}}, animation will only play {{tt|1}} frame using the index specified by {{tt|LoopStart}} and then end. | |||
From {{tt|2}} to {{tt|10}}, there are {{tt|9}} numbers instead of {{tt|10-2}}={{tt|8}}. And {{tt|10}}={{tt|2+9-1}}. | |||
*This is obvious, so you need to {{tt|-1}} at the end to get the frame index. | |||
== Notes (1-based) == | |||
None loop (1-based): | |||
{{f|Start|link}}{{tt|+1}} -> {{tt|Start+}}{{f|End|link}} (← {{tt|Start+1 + End -1}}) | |||
Have loop (1-based): | |||
{{f|Start|link}}{{tt|+1}} -> {{f|LoopEnd|link}} -- [{{f|LoopCount|link}}-1 times] --><-> {{f|LoopStart|link}}{{tt|+1}} -> {{tt|Start+End}} (← {{tt|Start+1 + }}{{f|End|link}} {{tt| -1}}) | |||
== | *If {{tt|Start+1}} ≥ {{tt|LoopEnd}}, animation will only play {{tt|1}} frame using the index specified by {{tt|Start+1}} and then directly enter the second Loop; | ||
*If {{tt|LoopStart + 1}} ≥ {{tt|LoopEnd}}, then display 1 frame of {{tt|LoopStart + 1}}, and then proceed to the next Loop. | |||
*If {{tt|Start+End}} ≤ {{tt|LoopStart+1}}, animation will only play {{tt|1}} frame using the index specified by {{tt|LoopStart+1}} and then end. | |||
From {{tt|2}} to {{tt|10}}, there are {{tt|9}} numbers instead of {{tt|10-2}}={{tt|8}}. And {{tt|10}}={{tt|2+9-1}}. | |||
*This is obvious, so you need to {{tt|-1}} at the end to get the frame index. | |||
If | {{Bugs}} | ||
If an animation of a Loop is used by another animation via {{f|Next|link}}, then its {{tt|Start}} will be calculated by multiplying by 2. | |||
*For example, the following code will make {{tt|RING1}} and {{tt|PDFXLOC}} both stay for 2 frames at frame 11 (1-based) of the Shape before swapping. | |||
*However, if {{tt|RING1}} or {{tt|PDFXLOC}} are created using {{f|AnimList|link}}, the first playback will start from frame 6 (1-based). | |||
[ | [AnyAnim] | ||
Start= | Next=RING1 | ||
End=5 | |||
LoopStart= | [RING1] | ||
LoopEnd= | Start=5 | ||
LoopCount=-1 | 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, | |||
*{{tt|Start}}{{tt|*2}} -> {{tt|LoopEnd-1}} -- [{{tt|LoopCount}}-1 times] --> {{tt|LoopStart}}{{tt|+0}} -> {{tt|Start+End-1}} for ''0-based'' index; | |||
*{{tt|Start}}{{tt|*2+1}} -> {{tt|LoopEnd}} -- [{{tt|LoopCount}}-1 times] --> {{tt|LoopStart}}{{tt|+1}} -> {{tt|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 {{tt|RING1}} and {{tt|PDFXLOC}}, because {{tt|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. | |||
* {{f|AnimLow|link}} defines a ''0-based'' index of the first frame. | |||
* {{f|AnimHigh|link}} defines a ''0-based'' index of the last frame. | |||
The animation will loop indefinitely until the projectile expires in one way or another. | |||
== See Also == | |||
[[Next]] | |||
[[AnimRate]] | |||
[[Category:General_Editing_Information]] | [[Category:General_Editing_Information]] |
Latest revision as of 21:57, 10 February 2025
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.