Fix net code
This commit is contained in:
parent
1f10b9c750
commit
a1fb6755c7
23 changed files with 408 additions and 236 deletions
|
|
@ -0,0 +1,21 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
import { LinearInterpolator } from './linear-interpolator';
|
||||
|
||||
export class Vec2Interpolator {
|
||||
private x: LinearInterpolator;
|
||||
private y: LinearInterpolator;
|
||||
|
||||
constructor(currentValue: vec2) {
|
||||
this.x = new LinearInterpolator(currentValue.x);
|
||||
this.y = new LinearInterpolator(currentValue.y);
|
||||
}
|
||||
|
||||
public addFrame(value: vec2, rateOfChange: vec2) {
|
||||
this.x.addFrame(value.x, rateOfChange.x);
|
||||
this.y.addFrame(value.y, rateOfChange.y);
|
||||
}
|
||||
|
||||
public getValue(deltaTime: number): vec2 {
|
||||
return vec2.fromValues(this.x.getValue(deltaTime), this.y.getValue(deltaTime));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue