MotionScript

@motion-script/core


@motion-script/core / AttributePropOptions

Interface: AttributePropOptions<Ext, Int>

Defined in: attributes/properties/typed.ts:65

Attribute-typed variants of @property.

A rich attribute (a fill, a stroke, a corner radius) is only declarative and tweenable because its @property carries the matching mapper (loose author input → resolved value) and tween (how the resolved value interpolates). Getting that pair right means knowing which resolveXArray/lerpXArray belong together — several of which are @internal — so a custom node that wants a second fill has to copy an incantation out of ShapeNode.

These decorators pre-bake each pair. @fillProperty() is exactly @property({ default: [], mapper: resolveFillArray, tween: lerpFillArray }), so everything downstream — set(), to(), save()/restore(), () => … bindings — behaves identically; only the declaration gets shorter.

class Card extends Rect {
    @fillProperty({ default: "white/10" }) declare glow: Fill;
    @strokeProperty() declare edge: Stroke;
    @cornerRadiusProperty({ default: 12 }) declare notch: RectCornerRadius;
}

// <Card glow="red" /> · card().to({ glow: Fills.linearGradient([...]) }, 0.6)

Each takes the same options as @propertydefault, plus mapper/tween to override the built-in pair for a one-off case.

As with @property, the field is declared with the loose author-facing type (Fill, not FillResolved[]) so assignment and reads share one type; the accessor stores the resolved value and consumers cast at the read site.

Type Parameters

Ext

Ext

Int

Int

Properties

default?

optional default?: Ext

Defined in: attributes/properties/typed.ts:67

Initial value, used when the constructor props object omits the key.


mapper?

optional mapper?: (ext, prev?) => Int

Defined in: attributes/properties/typed.ts:69

Override the attribute's built-in external → internal mapper.

Parameters

ext

Ext

prev?

Int

Returns

Int


tween?

optional tween?: TweenFn<Int>

Defined in: attributes/properties/typed.ts:71

Override the attribute's built-in lerp for to().