Basic canvas parallax

This commit is contained in:
Schmelczer András 2020-01-03 20:51:18 +01:00
parent 3bed56ed4b
commit 576d06e4bd
9 changed files with 260 additions and 172 deletions

View file

@ -0,0 +1,17 @@
export class Vec2 {
public static readonly Zero = new Vec2(0, 0);
public constructor(public readonly x: number, public readonly y: number) {}
public add(other: Vec2): Vec2 {
return new Vec2(this.x + other.x, this.y + other.y);
}
public subtract(other: Vec2): Vec2 {
return new Vec2(this.x - other.x, this.y - other.y);
}
public multiply(other: Vec2): Vec2 {
return new Vec2(this.x * other.x, this.y * other.y);
}
}