CompositeField

← prev index next →

Combines several fields into one by blending their weights — the field for masking, layering, and carving one field with another.

Remarks

This is a field that composes other fields, taking its place in the SpatialField family: like every field it turns where into how much — a scalar weight consumers read by #id (field="#id") — but instead of computing weight from geometry, it references two or more child fields and blends their weights into a single result. That makes it the way to build compound influence: mask a noise field by a falloff, union two shapes, or subtract one region from another.

Key attributes. fields is a space-separated list of the child fields to combine, each by #id; field-blend-modes is a parallel list of how to fold each one in — max (union, strongest wins), min (intersection), multiply (masking), add (accumulate, clamped), or subtract (erosion, clamped). The lists run in order: the first field seeds the result, so its blend mode is a placeholder that never applies; each later field combines with the accumulated weight. The result is itself a field, so it plugs into any field="#id" slot.

Related. It blends any fields — spatial shapes like sk-spherical-gradient-field, sk-noise-spatial-field, or even another composite. Typical consumers are a sk-color-map-source, a sk-tonemap, a sk-simple-point-constraint, or sk-field-constraint.

Constructor

constructor()

Properties

Other Properties

PropertyTypeDefaultDescriptionDeclared by
remapCurveanimatable SampledCurve | null Optional curve that reshapes this composite field's combined output. CompositeField
remapPhaseanimatable number 0 Horizontal remap phase — an animatable scalar that translates a present CompositeField
enabled boolean true Whether this field is enabled. When disabled, evaluate() returns 0. CompositeField
fieldCountread-only number The number of child fields. CompositeField
fieldEntriesread-only readonly CompositeFieldEntry[] The ordered list of resolved layer entries (each carrying its CompositeField
fields string "" The fields <id-ref-list> as a property. Reads / writes the CompositeField
fieldBlendModes string "" The companion field-blend-modes list as a property. Reads / CompositeField
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

Methods

MethodDescriptionDeclared by
addField(field: Field): void Convenience: appends a child field with the family default blend CompositeField
removeField(field: Field): void Convenience: removes a field via the fields attribute. CompositeField
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

Example

const composite = new CompositeField();
composite.addField(sphereField);     // family default: max
composite.addField(crossLineField);
composite.fieldBlendModes = 'max multiply';

// Evaluates both fields and combines weights
const weight = composite.evaluate([5, 0, 0], [0, 0.3]);