Skip to content

1681-engine / index / ColorGrade

Class: ColorGrade ​

Defined in: src/ambient/ColorGrade.ts:30

A colour laid over the whole screen in multiply, so it tints the world (a marsh mossy, a peak ember, a dead land pale) without washing the art toward white the way a normal-blend sheet would. One white quad, tinted: no filter pass, which is what a phone can spare every frame.

read returns the grade now (gradeAt from a place's Grade and DayClock's night, say); it is asked a few times a second, and a grade that comes to white is not drawn at all. Give placement: 'bottom' to keep it off the HUD (see ColorGradeOptions.placement).

Constructors ​

Constructor ​

ts
new ColorGrade(
   stage, 
   read, 
   options?
): ColorGrade;

Defined in: src/ambient/ColorGrade.ts:36

Parameters ​

ParameterType
stageStage
read() => GradeState | null
optionsColorGradeOptions

Returns ​

ColorGrade

Methods ​

destroy() ​

ts
destroy(): void;

Defined in: src/ambient/ColorGrade.ts:75

Returns ​

void


invalidate() ​

ts
invalidate(): void;

Defined in: src/ambient/ColorGrade.ts:50

Reads the grade again on the next update (the place changed).

Returns ​

void


update() ​

ts
update(now, enabled?): void;

Defined in: src/ambient/ColorGrade.ts:55

enabled: the game's setting, and off under a battery saver — a full-screen blend is a cost on a phone.

Parameters ​

ParameterTypeDefault value
nownumberundefined
enabledbooleantrue

Returns ​

void

Released under the MIT License.