refactor: masking

This commit is contained in:
cha0s 2021-03-28 16:33:18 -05:00
parent ecb288b5d6
commit e2f655f7cc

View File

@ -215,22 +215,18 @@ export default class TilesView extends Container {
k += (isReversed ? -1 : 1)
) {
const [x, y] = points[k];
const shift = Vector.scale(
Vector.mul(
[
noise(Vector.scale([x, y], 8)),
noise(Vector.scale([y, x], 8)),
],
[
noise(Vector.scale([y, x], 20)),
noise(Vector.scale([x, y], 20)),
],
),
6,
);
const ANGLE_SCALE = 1000;
const WALK_SCALE = 1000;
const MAGNITUDE = 6;
const [vx, vy] = Vector.add(
points[k],
shift,
Vector.scale(
Vector.scale(
Vector.fromRadians(Math.PI * noise(Vector.scale([x, y], ANGLE_SCALE))),
noise(Vector.scale([x, y], WALK_SCALE)),
),
MAGNITUDE,
),
);
ctx.lineTo(vx, vy);
}