Code Monkey home page Code Monkey logo

ramp.js's Introduction

RAMP

NodeJS Interpolation Library

New objects

The library add a class template to manage interpolation beetween values of various data types.

  • rampNumber ramp object for "number" interpolation

Methods

  • go() go to a new value
  • value() get actual value of the interpolation
  • origin() get last origin value of the interpolation
  • target() get last target value of the interpolation
  • duration() get last duration of the interpolation
  • update() update value of the interpolation according to its parameters
  • pause() pause the interpolation
  • resume() resume from pause
  • setGrain() set interpolation grain
  • setAutomation() set automation mode
  • isPaused() pause state
  • isRunning() running state
  • isFinished() finish state

Examples

First you need to instanciate the object as a global variable :

let myRamp = new Ramp();

Then you need to a new value to reach :

myRamp.go(new_value, (ramp_duration), (ramp_mode), (loop_mode));

At least you'll need to update to get the actual interpolation value :

myInterpolationValue = myRamp.update();

Interpolation mode

  • NONE
  • LINEAR
  • QUADRATIC_IN
  • QUADRATIC_OUT
  • QUADRATIC_INOUT
  • CUBIC_IN
  • CUBIC_OUT
  • CUBIC_INOUT
  • QUARTIC_IN
  • QUARTIC_OUT
  • QUARTIC_INOUT
  • QUINTIC_IN
  • QUINTIC_OUT
  • QUINTIC_INOUT
  • SINUSOIDAL_IN
  • SINUSOIDAL_OUT
  • SINUSOIDAL_INOUT
  • EXPONENTIAL_IN
  • EXPONENTIAL_OUT
  • EXPONENTIAL_INOUT
  • CIRCULAR_IN
  • CIRCULAR_OUT
  • CIRCULAR_INOUT
  • ELASTIC_IN
  • ELASTIC_OUT
  • ELASTIC_INOUT
  • BACK_IN
  • BACK_OUT
  • BACK_INOUT
  • BOUNCE_IN
  • BOUNCE_OUT
  • BOUNCE_INOUT

Loop mode

  • ONCEFORWARD
  • LOOPFORWARD
  • FORTHANDBACK
  • ONCEBACKWARD
  • LOOPBACKWARD
  • BACKANDFORTH

Disclaimer

This Libary is just translated from RAMP for Arduino (siteswapjuggler). I will merge updates from that Libary into this Libary. But i am not an expert at this topic. Have fun :)

ramp.js's People

Contributors

siteswapjuggler avatar supermomme avatar vaasref avatar per1234 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.