0.3.5 • Published 6 years ago

herm-js-network v0.3.5

Weekly downloads
2
License
Apache 2.0
Repository
github
Last release
6 years ago

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