in livelooping there is this concept called First Loop, which is setting the tempo based on the time between a start and end point. knowing this could you write me some code for a basic first loop setter in base javascript?