<sk-wgsl-uniform>

← prev index next →

Feeds a single animatable scalar into your custom WGSL shader — the simplest way to expose one live-tunable number (an amplitude, a mix factor, a time knob) to hand-written shader code.

Remarks

This is the scalar member of the shader-input family that belongs to the compute & custom-WGSL concept (AbstractComputeNode), and — modeled on ColorStop — it is itself a SkenraAnimatable. Unlike an inert keyframe, its value can change at runtime, set imperatively or driven by a nested <sk-animation>; each change notifies the owning host, which repacks that one slot of its GPU buffer with no shader rebuild (a value is shader DATA, while name and the set of uniforms are structural).

Key attributes. name is a non-animatable WGSL identifier, unique per host — changing it, or adding/removing/reordering uniforms, re-keys the shader. value is the animatable scalar. The host aggregates its uniform children in DOM order and generates a skUniform_<name>() -> f32 accessor, so the shader reads the value by name and the author never hand-counts lanes.

Related. It is a child of any custom-WGSL host — sk-custom-wgsl-color-source, sk-custom-wgsl-points-source, sk-custom-wgsl-point-constraint, sk-custom-wgsl-spline-source, or sk-compute-node. For non-scalar inputs use the sibling uniforms sk-wgsl-f32-array-uniform, sk-wgsl-vec2-uniform, sk-wgsl-vec3-uniform, sk-wgsl-vec4-uniform, and sk-wgsl-color-uniform (a colour authored as a string).

Serve these docs to run the live example. WebGPU needs a secure context — open this page via grunt serve rather than double-clicking the file. The Markup tab works from disk.

Attributes

AttributeTypeDefaultDescription
id <id> The element's unique identifier — the standard HTML global id attribute.
namerequired <string> "" Gets the WGSL identifier this member is addressed by.
valuerequiredanimatable <number> 0 Gets the scalar value, returning the animated value when animating.