velocitymodel

0.2.2 • Public • Published

velocitymodel

PD controlled velocity model with optional animation extension

Demo here

Install the module:

npm i -S velocitymodel

Example usage:

import VelocityModel from 'velocitymodel/lib/velocitymodel';
import ModelAnimator from 'velocitymodel/lib/modelanimator';
 
const indicator = document.querySelector('#indicator');
const updater = (value) => {
  indicator.style.left = value; // or however you want to use the value
};
const P = 100; // Propotional part
const D = 10; // Velocity part
const model = new VelocityModel(P, D);
const animator = new ModelAnimator(model, updater);
 
animator.setTarget(222);

Package Sidebar

Install

npm i velocitymodel

Weekly Downloads

0

Version

0.2.2

License

MIT

Last publish

Collaborators

  • ez