@blinkk/degu
    Preparing search index...

    Class Interpolate

    A class that interperolate between values. Interperolate is really a compositoin around mathf.ease.

    import { EASE, Interpolate } from '@blinkk/degu'
    let inter = new Interpolate({
    from: 0,
    to: 100,
    easeFunction: EASE.linear
    });

    inter.calculate(0.3); // return 30.

    inter.calculate(0.6); // return 60

    // Get the value from currentValue if needed.
    console.log(inter.currentValue); // 60

    This can be useful to create low level tweens. Here for example, we can manually, tween the x and y positions of a ball with separate easing.

    import { Raf, EASE, Interpolate } from '@blinkk/degu'

    this.progress = 0;
    let ballXInter = new Interpolate({
    from: 30,
    to: 100 ,
    easeFunction: EASE.easeOutSine
    })
    let ballYInter = new Interpolate({
    from: 30,
    to: 100 ,
    easeFunction: EASE.linear
    })

    // See RafTimer for how this works. Basically, here we are running raf for
    // 300ms and the progress is a value between 0-1 which we used to passed to the
    // interperolators.
    new RafTimer((progress)=> {
    // Update the positions of ball.
    ball.x = ballXInter.calculate(this.progress);
    ball.y = ballYInter.calculate(this.progress);
    }).start(300);

    See more examples in the /examples folder

    Unit and Color support.

    Interpolate also uses [[cssUnit]] to interprete string values (as best as it can). You can pass basic css unit values such as '10px' or '10vw' as from and to values. Color values of rgba and hex are also supported.

    It does NOT support cross unit interporalation at the moment such as from: '0px', to: '10vw'. (Here the units don't match.)

    let inter = new Interpolate({
    from: '0px',
    to: '100px',
    easeFunction: EASE.linear
    });
    inter.calculate(0.3); // return '30px'.


    inter = new Interpolate({
    from: 'rgba(255, 255, 255, 0)',
    to: 'rgba(0,0,0,1)',
    easeFunction: EASE.linear
    });
    inter.calculate(0.5) // 'rgba(127, 127, 127, 0.5)'
    Index
    currentProgress: number

    The current progress.

    currentValue: string | number

    The current interperolated value.