MotionScript

@motion-script/core


@motion-script/core / EffectData

Interface: EffectData<T>

Defined in: attributes/shape/effects/effect-data.ts:141

Type Parameters

T

T

Properties

equals

equals: (a, b) => boolean

Defined in: attributes/shape/effects/effect-data.ts:157

Compares two effect states for deep equality.

Parameters

a

T

The first effect state.

b

T

The second effect state.

Returns

boolean

True if the effects are structurally identical, otherwise false.


lerp

lerp: (from, to, t) => T

Defined in: attributes/shape/effects/effect-data.ts:149

Linearly interpolates between two effect states.

Parameters

from

T

The starting state of the effect.

to

T

The target state of the effect.

t

number

The interpolation factor (usually a normalized value between 0 and 1).

Returns

T

A new effect state representing the blended value.


surface?

optional surface?: EffectSurface | ((effect) => EffectSurface)

Defined in: attributes/shape/effects/effect-data.ts:168

How a backend must realise this effect. Defaults to "filter"; effects that resample pixel positions declare "shader". Drives which render path the effect takes — see EffectSurface.

A predicate handles effects whose surface depends on their own fields — a foreground sksl overlay composes as a filter, while the same effect in backdrop mode resamples what is beneath it.

Methods

prepare()?

optional prepare(effect, tracker, width, height): void

Defined in: attributes/shape/effects/effect-data.ts:183

Declare any assets this effect needs at the current frame, so they are loaded before it renders.

The mirror of FillData.prepare — an image fill calls tracker.requestImage(src, …) here, and an effect that samples a texture does exactly the same. Without it the asset is never requested and the backend's synchronous lookup returns nothing, which the effect can only interpret as "no texture".

width/height are the node's box in logical px, the size hint the loader rasterises SVGs and downsamples large images against.

Parameters

effect

T

tracker

AssetTracker

width

number

height

number

Returns

void