@GreenSock I love it! π
https://codepen.io/jh3y/pen/xxRKggV
I've gone through the code and retyped it to walk through. I think I understand most parts. Very clever! π
I'm looking to write this up/make a video on it at some point. It would be cool to show the evolution of implementing it. Of course, I'll be crediting this forum heavily π
I love the solution you've presented because it's GSAP'ping GSAP if I'm understanding it right which I think is brilliant.
I've made some notes and things I've tried to understand. I'm more than happy with an ELI5 on some of these if you're able to. I'd love to properly understand it. I love this kind of thing as it gives me something new to dig into/challenge myself with understanding.
- raw timeline powers card appearance. This is neat. Although my "Map" approach worked, this is more GSAPPY and accurate. If we wanted to offset the scale, etc. We'd introduce another `fromTo` with a `yoyo` and maybe a reduced duration with a delay/position?
- Wrapping. This part seems straighforward. If we go forward, increment, if we go backward, decrement. Keep going backwards and we keep counting down from 10. The iteration is used for accuracy with the scrub?
- The main mechanism. I think this is something I need to type out to clarify my thinking which could be off π
We use scrollTrigger to update the totalTime of the scrub. And that puts the loop playhead into different positions which in turn updates the position of the raw timeline? There's a bit to swallow there π
- The overlap part. I'm not 100% sure about how this works. This part I probably need a little ELI5 on as well. It's mainly this part. The overlap adds extra time playing the raw timeline which makes it loop round better. And that's because inside there would be a wrap in either direction?
LOOP
.to(RAW, {
time: LOOP_TIME,
duration: LOOP_TIME - START,
ease: 'none',
})
.fromTo(
RAW,
{ time: OVERLAP * SPACING + 1 },
{
time: START,
duration: START - (OVERLAP * SPACING + 1),
immediateRender: false,
ease: 'none',
}
)
Sorry if these are obvious questions. I'd love to get a proper handle on this before attempting to write about it. Think it's a real cool thing to show. The idea behind building something like this was to use it to showcase the CodePen on my site with π