timeline interaction as you scroll
optimize the scroll function to reduce unnecessary loops