Shades a surface by how much light it receives — mapping full shadow to one color and full light to another through a referenced color-map — the way to author non-photographic, illustrative lighting instead of physically-fixed shading.
Declarative element:
<sk-tonemap>
Global: available as sk.Tonemap inside a scene <script>.
This is the concrete member of the AbstractTonemap family: like every
tonemap it turns the lighting parameter (0 = full shadow, 1 = full light) into
a color, so shading is authored rather than physically determined. It supplies
that light-driven t; the ColorMap it names turns t into the pixel
color; and an optional field can restrict where the tonemap applies.
Key attributes. color-map names the color-map to look up — it is
REQUIRED, and a tonemap with no resolvable color-map is inert (renders
nothing). field is an optional applicability mask: where its weight is 1 the
tonemap fully applies, and where its weight is 0 it drops out to the material's
effective base color shaded by light alone (without the color-map), so a field
can fade the illustrative shading in over part of a surface. The color-map's own
field, the tonemap's field, and the base-color compositing are each applied
exactly once — nothing is double-counted.
Driver remap. A tonemap carries its OWN remap-curve that reshapes the
light parameter t BEFORE it reaches the hosted color-map — inverse:linear
flips a screen so light ink grows toward the lit side. This composes with any
remap the color-map itself carries (t_map = mapCurve(driverCurve(t))), so
the two are independent stages: the tonemap's driver remap reshapes what the
color-map is asked to look up, and the color-map's remap reshapes its own
response. Both the curve VALUES and a remap-phase scalar (which slides the
lookup horizontally, remap(wrap(t − phase)), applied after inversion) are
animatable and data-only; remap-phase on the tonemap translates the DRIVER
stage, while remap-phase on the inner color-map translates the MAP stage,
and the two compose.
Related. The color-map it drives is any member of the color-map family —
sk-ramp-color-map (built from sk-color-stop children),
sk-composite-color-map, or a dither map such as
sk-halftone-dither-color-map. A material selects a tonemap with
tonemap="#id" (see sk-plain-material); for a base color that varies by
space rather than by light, its spatial counterpart is the
ColorSource family.
constructor()
Inherited from: AbstractTonemap, SkenraAnimatable
— see those pages for inherited members.
| Property | Type | Default | Description | Declared by |
|---|---|---|---|---|
colorMap |
ColorMap | null |
— | The referenced color-map, or null when unresolved. Setting it imperatively | Tonemap |
remapCurveanimatable |
SampledCurve | null |
— | Optional DRIVER remap curve: reshapes the tone value handed to the | Tonemap |
remapCurveSourceread-only |
string | null |
— | The descriptor the curve was authored from, or null (imperative/none). |
Tonemap |
remapPhaseanimatable |
number |
0 |
Horizontal driver remap phase — an animatable scalar that translates the | Tonemap |
fieldanimatable |
Field | null |
— | Gets the optional field that modulates this tonemap's weight per-fragment. | AbstractTonemap |
sceneread-only |
any |
— | Gets the Scene this animatable belongs to, if any. | SkenraAnimatable |
animationsread-only |
SkenraAnimation[] |
— | Public getter for the animations affecting this target. | SkenraAnimatable |
| Method | Description | Declared by |
|---|---|---|
animate(firstArg: TypedKeyframe<this>[] | TypedPropertyIndexedKeyframes<this> | Record<string, any> | globalThis.Keyframe[] | globalThis.PropertyIndexedKeyframes | null, secondArg?: number | KeyframeAnimationOptions | globalThis.KeyframeAnimationOptions): SkenraAnimation & Animation |
Creates a new SkenraAnimation for this target per Web Animations API. | SkenraAnimatable |
removeAnimation(animation: SkenraAnimation): boolean |
Removes a specific animation from this object. | SkenraAnimatable |
constrain(type: K, config: ConstraintConfigMap[K]): ConstraintReturnMap[K] |
Creates a constraint on this Animatable using a fluent API. | SkenraAnimatable |