I try to create an image-changer with the WAAPI.
There's a loop of pictures where delay is supposed to increase and endDelay to decrease, but it doesn't work in iterations:
var changer = document.querySelector( '#gallery' ),
children = changer.querySelectorAll( 'figure'),
aniStartDelay = 0,
aniDur = 3000,
aniCombined = (aniStartDelay + aniDur) * (children.length),
aniEndDelay = aniCombined - (aniDur + aniStartDelay);
for (var index = 0; index < children.length; index++) {
children[index].animate([
{ opacity: 0 },
{ opacity: 1 },
{ opacity: 1 },
{ opacity: 0 }
], {
duration: aniDur,
delay: aniStartDelay,
endDelay: aniEndDelay,
iterations: Infinity
});
console.log('aniDur: ' + aniDur +', \n aniStartDelay: ' + aniStartDelay + ', \n aniEndDelay: ' + aniEndDelay +'\n\n aniCombined: ' + aniCombined);
aniStartDelay = aniStartDelay + aniDur;
aniEndDelay = aniEndDelay - aniDur;
}
After two iterations it just seems to flicker irregularly.
I'd be grateful for any ideas to battle this.
TIA Matthias