Feeds an animatable vec2<f32> into your custom WGSL shader — the way to hand
shader code a live 2D value such as a screen-space center, a UV offset, or a 2D
direction.
Declarative element:
<sk-wgsl-vec2-uniform>
Not on the sk.* global — construct via the declarative element or a module import.
This is the two-component member of the shader-input family that belongs to the
compute & custom-WGSL concept (AbstractComputeNode); like
ColorStop it is itself a SkenraAnimatable. The vector type lives
in the TAG (never a type attribute), and each value change repacks the
host's GPU buffer slot with no shader rebuild.
Key attributes. name is the non-animatable WGSL identifier (unique per
host). x and y are the two independent, animatable component axes. The
packed lanes start on an even lane (std140 vec2 alignment), and the host
generates a skUniform_<name>() -> vec2<f32> accessor so the shader reads the
whole vector by name.
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 a single
value use sk-wgsl-uniform; for other widths use
sk-wgsl-vec3-uniform, sk-wgsl-vec4-uniform, or the
sk-wgsl-f32-array-uniform; for a colour authored as a string use
sk-wgsl-color-uniform.
constructor()
Inherited from: AbstractWGSLUniformMemberElement, SkenraAnimatable
— see those pages for inherited members.
| Property | Type | Default | Description | Declared by |
|---|---|---|---|---|
xanimatable |
number |
0 |
Gets the x component, returning the animated value when animating. | WGSLVec2Uniform |
yanimatable |
number |
0 |
Gets the y component, returning the animated value when animating. | WGSLVec2Uniform |
name |
string |
"" |
Gets the WGSL identifier this member is addressed by. | AbstractWGSLUniformMemberElement |
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 |
const u = document.createElement('sk-wgsl-vec2-uniform') as WGSLVec2Uniform;
u.name = 'center';
u.x = 0.5;
u.y = -0.25;