Noosphere Possibilities Maximized

    eased-oscillator

    1.0.0 • Public • Published

    Build Status

    Eased Oscillator

    Produces a function that oscillates between two values with an easing function

    Usage

     
    var osciQuad = easedOsc({
        min: 10,
        max: 20,
        steps: 2,
        easing: 'linear'
    });
     
    console.log(osciQuad()); // 10
    // each time the function is called, the step value oscillates between the min and max
    console.log(osciQuad()); // 15
    console.log(osciQuad()); // 20
    console.log(osciQuad()); // 15
    console.log(osciQuad()); // 10
    console.log(osciQuad()); // 15
    // etc..
     

    Users can also specify a custom easing function if they wish:

     
    var linearOsc = easedOsc({
        min: 0,
        max: 5,
        steps: 5,
        easing: function(t,b,c,d){
            return c * t / d + b;
        }
    });
     
    console.log(linearOsc()); // 0
    console.log(linearOsc()); // 1
    console.log(linearOsc()); // 2
    // etc..
     
     

    Install

    npm i eased-oscillator

    DownloadsWeekly Downloads

    1

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • dazld