Skip to content

whitelizard/velocitymodel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);

About

PD controlled velocity model with optional animation

Resources

License

Stars

Watchers

Forks

Packages

No packages published