@pointC, @Sahil,
Thanks to you both.
Ok so I've got the idea of a master timeline and triggering tidy functions from the excellent css tricks article.
This is where I was at just before @pointC kindly did it for me again!.....
// RED DOTS TO RIGHT
function dotMove() {
var dot = document.getElementsByClassName("animation-inner-dot");
var tl = new TimelineMax();
tl.staggerTo(dot, 3.5, {x: 422, repeat: -1, ease:Linear.easeNone}, 0.7);
return tl;
}
// BLINKING RED DOTS
function dotPulse() {
var pulse = document.getElementsByClassName("animation-pulse-dot");
var tl = new TimelineMax();
tl .staggerTo(pulse, 3.5, {opacity:0, repeat: -1, scale: 4, delay: 1.95, ease:Power4.easeOut }, 0.7);
return tl;
}
var master = new TimelineMax();
master.add( dotMove().timeScale(0.5) );
master.add ( dotPulse().timeScale(0.5), 0 );
Now from looking at @pointC's pen I could theoretically speed up or slow down an entire animation sequence with something like the following...Basically adjusting the timescale in one place on the master.
var master = new TimelineMax().timeScale(0.5);
master.add( dotMove );
master.add ( dotPulse(), 0 );
master.add ( somethingElse(), 0 );
master.add ( anotherThing(), 0 );
I think I'm starting to picture how things might fit together in nested timelines as complexity builds.
One thing I'm not sure of is in this code from @pointC.... In the "animation-pulse-dot" tween at the end there is the 0.7 stagger delay but what is the 1.95 value doing?
console.clear();
var tl = new TimelineMax().timeScale(0.5);
tl.staggerTo(".animation-inner-dot", 3.5, {x: 422, repeat:-1, ease:Linear.easeNone}, 0.7)
tl.staggerTo(".animation-pulse-dot", 3.5, {opacity:0, scale: 4, repeat:-1, ease:Power4.easeOut }, 0.7, 1.95);
And just one last question about the forum in general. What is considered best to do with example pens. How long should they be left in the post so others can see the example relating to the initial question. Really I'm asking at what point is it reasonable to delete example pens form my codepen or should they be left accessible indefinitely.
EDIT: I realise what the 1.95 value is. Alternative place to put the start delay....
Many thanks again
Mark