Animation Looping: Difference between revisions
Added projectile anim loop flags |
No edit summary |
||
Line 6: | Line 6: | ||
* {{f|Start|link}} 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. | * {{f|Start|link}} 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. | ||
* {{f|End|link}} defines the number of frames to play for the first iteration. End is only used if the total number of iteration is 1, which happens when LoopCount is not defined or LoopCount | * {{f|End|link}} defines the number of frames to play for the first iteration . End is only used if the total number of iteration is 1, which happens when {{tt|LoopCount}} is not defined or {{f|LoopCount|1|link}}. | ||
* {{f|LoopStart|link}} defines a ''0-based'' index of the first frame for loop iterations. | **If the total number of iterations is more than 1, then {{tt|End}} value is disregarded and instead {{tt|LoopEnd}} is used. and the first iteration will end anyway with the {{tt|LoopEnd}} frame of the SHP (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|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. | * {{f|LoopEnd|link}} defines a '''''1'''-based'' index of the last frame when total number of iterations is more than one. | ||
* {{f|LoopCount|link}} defines the total amount of iterations to play. Value 1 is for a single iteration where the Start and End values are used instead of LoopStart and LoopEnd. Value -1 is used for infinite loop. | * {{f|LoopCount|link}} defines the total amount of iterations to play. Value 1 is for a single iteration where the Start and End values are used instead of LoopStart and LoopEnd. Value -1 is used for infinite loop. | ||
* {{f|End|link}} flag when total number of iteration larger than 1 ( {{tt|LoopCount}} more than 1): | |||
** If {{tt|End}} > {{tt|LoopEnd}}, it will control the frame that needs to be played after the last Loop. | |||
*** In this case, it represents the '''frame index starting''' from 1. | |||
** If {{tt|End}} <= {{tt|LoopEnd}}, then {{tt|LoopEnd}} will end directly. | |||
== Notes == | |||
No loop (1-based): | |||
{{tt|Start+1}} -> {{tt|Start+1+End}} | |||
*{{tt|Start}} defines a ''0-based'' index | |||
*{{tt|End}} defines the number of frames to play | |||
Loop: | |||
{{f|Start|link}} -> {{f|LoopEnd|link}} -- [{{f|LoopCount|link}}-1 times] --> {{f|LoopStart|link}} -> {{f|LoopEnd|link}} -> {{f|End|link}}(if {{tt|End}} <= {{tt|LoopEnd}}, end directly) | |||
*{{tt|End}} defines a ''1-based'' index | |||
In order to facilitate understanding that {{tt|Start}} does not necessarily have to be less than {{tt|LoopStart}}, | |||
the loop process is represented here by {{tt|LoopEnd}} -> {{tt|LoopStart}} for {{tt|LoopCount-1}} times, plus the final {{tt|LoopStart}} -> {{tt|LoopEnd}}. | |||
{{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 they are created using {{f|AnimList|link}}, 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, | |||
*{{tt|Start}} * 2 + 0, ({{tt|End-1}}) * 2 + 0 for ''0-based'' index; | |||
*{{tt|Start}} * 2 + 1, ({{tt|End-1}}) * 2 + 1 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 == | == Projectiles == | ||
Line 19: | Line 69: | ||
The animation will loop indefinitely until the projectile expires in one way or another. | The animation will loop indefinitely until the projectile expires in one way or another. | ||
== See Also == | |||
[[Next]] | |||
[[Category:General_Editing_Information]] | [[Category:General_Editing_Information]] |
Revision as of 14:40, 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 to play for the first iteration . End is only used if the total number of iteration is 1, which happens when LoopCount is not defined or LoopCount=1.
- If the total number of iterations is more than 1, then End value is disregarded and instead LoopEnd is used. and the first iteration will end anyway with the LoopEnd frame of the SHP (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).
- LoopStart defines a 0-based index of the first frame for loop iterations.
- LoopEnd defines a 1-based index of the last frame when total number of iterations is more than one.
- LoopCount defines the total amount of iterations to play. Value 1 is for a single iteration where the Start and End values are used instead of LoopStart and LoopEnd. Value -1 is used for infinite loop.
- End flag when total number of iteration larger than 1 ( LoopCount more than 1):
- If End > LoopEnd, it will control the frame that needs to be played after the last Loop.
- In this case, it represents the frame index starting from 1.
- If End <= LoopEnd, then LoopEnd will end directly.
- If End > LoopEnd, it will control the frame that needs to be played after the last Loop.
Notes
No loop (1-based):
Start+1 -> Start+1+End
- Start defines a 0-based index
- End defines the number of frames to play
Loop:
Start -> LoopEnd -- [LoopCount-1 times] --> LoopStart -> LoopEnd -> End(if End <= LoopEnd, end directly)
- End defines a 1-based index
In order to facilitate understanding that Start does not necessarily have to be less than LoopStart,
the loop process is represented here by LoopEnd -> LoopStart for LoopCount-1 times, plus the final LoopStart -> LoopEnd.
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 they 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 + 0, (End-1) * 2 + 0 for 0-based index;
- Start * 2 + 1, (End-1) * 2 + 1 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.