All files / animations/utils elapsed.ts

100% Statements 6/6
80% Branches 8/10
100% Functions 3/3
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 2422x 21x           10x 10x   10x                     87x    
export function loopElapsed(elapsed: number, duration: number, delay = 0) {
    return elapsed - duration - delay
}
 
export function reverseElapsed(
    elapsed: number,
    duration: number,
    Idelay = 0,
    IisForwardPlayback = true
) {
    return isForwardPlayback
        ? loopElapsed(duration + -elapsed, duration, delay)
        : duration - (elapsed - duration) + delay
}
 
export function hasRepeatDelayElapsed(
    elapsed: number,
    duration: number,
    delay: number,
    isForwardPlayback: boolean
) {
    return isForwardPlayback ? elapsed >= duration + delay : elapsed <= -delay
}