Minor improvements xd

This commit is contained in:
Andras Schmelczer 2023-05-21 19:19:12 +01:00
commit 0e97e54ffe
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
21 changed files with 189 additions and 184 deletions

View file

@ -1,11 +1,22 @@
import { settings } from '../settings';
import { hsl } from '../utils/colors/hsl';
import { hash } from '../utils/hash';
import { last } from '../utils/last';
import { Random } from '../utils/random';
import { vec3 } from 'gl-matrix';
const hues = [settings.startColorHue];
for (let i = 0; i < 100; i++) {
hues.push((last(hues) + Random.randomBetween(90, 240)) % 360);
}
const colors = hues.map((hue) =>
hsl(hue, Random.randomBetween(80, 90), Random.randomBetween(20, 30))
);
export class GamePresentation {
public getGenerationColor(generation: number): vec3 {
const hue = Math.round(hash(generation) * 360);
return hsl(hue, 100, 50);
public static getGenerationColor(generation: number): vec3 {
return colors[generation % colors.length];
}
}