Minor improvements xd
This commit is contained in:
parent
f3f2547724
commit
0e97e54ffe
21 changed files with 189 additions and 184 deletions
|
|
@ -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];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue