herm-js-network

0.3.5 • Public • Published

Herm network tools

NPM

Collection of network wrappers for Herm

Network compensator

Allow you to interpolate values based on time thought network calls.

import { NetworkCompensator } from 'herm-js';
 
const characterPosition = {
    x: new NetworkCompensator(0),
    y: new NetworkCompensator(0),
    z: new NetworkCompensator(0),
};
 
network.onValue((position) => {
    characterPosition.x.set(position),
    characterPosition.y.set(position),
    characterPosition.z.set(position),
});
 
...
 
// even if no network update is received, Herm interpolate and guess the next value
 
requestAnimationFrame(() => character.setPosition(characterPosition));

Package Sidebar

Install

npm i herm-js-network

Weekly Downloads

0

Version

0.3.5

License

Apache 2.0

Unpacked Size

4.07 kB

Total Files

8

Last publish

Collaborators

  • azukaar