two animation chains (the tween chain and the play/action chain) will run in parallel // after this group is added to an Animator anim.add(group.toAnim());} One can combine multiple animation groups to achieve any desired construction of sequential and parallel animations.
{@code AnimGroup group2 = new AnimGroup(); group2.tweenXY(...).then().tweenAlpha(...); group2.play(sound).then().action(...); AnimGroup group1 = new AnimGroup(); group1.delay(1000).then().add(group2.toAnim()); group1.delay(500).then().play(sound); // group 1's two animation chains will be queued up to run in parallel, and the first of its // chains will delay 1s and then trigger group 2's chains, which themselves run in parallel anim.add(group1.toAnim());}
It is of course also possible to add a group with a single animation chain, which will contain no parallelism but can still be useful for situations where one wants to compose sequences of animations internally and then return that package of animations to be sequenced with other packages of animations by some outer mechanism:
{@code}class Ship Animation createExplosionAnim () { AnimGroup group = new AnimGroup(); group.play(sound).then().flipbook(...); return group.toAnim(); } } }