MotionScript

@motion-script/core


@motion-script/core / Curve

Class: Curve

Defined in: attributes/audio/filters/curve.ts:56

Portable, immutable, fluent automation curve for one numeric param.

Constructors

Constructor

new Curve(segments?): Curve

Defined in: attributes/audio/filters/curve.ts:57

Parameters

segments?

readonly CurveSegment[] = []

Returns

Curve

Properties

segments

readonly segments: readonly CurveSegment[] = []

Defined in: attributes/audio/filters/curve.ts:57

Methods

fadeIn()

fadeIn(duration, opts?): Curve

Defined in: attributes/audio/filters/curve.ts:74

Append a fade from 0 up over duration seconds, anchored at the clip start.

Parameters

duration

number

opts?
ease?

EasingFunction

Returns

Curve


fadeOut()

fadeOut(duration, opts?): Curve

Defined in: attributes/audio/filters/curve.ts:79

Append a fade down to 0 over duration seconds, anchored to the clip end.

Parameters

duration

number

opts?
ease?

EasingFunction

Returns

Curve


hold()

hold(duration?): Curve

Defined in: attributes/audio/filters/curve.ts:69

Append a hold. With duration it sustains for that many seconds; bare hold() stretches to fill whatever time is left in the middle of the clip (only one auto-fill hold is allowed per curve).

Parameters

duration?

number

Returns

Curve


ramp()

ramp(from, to, duration, opts?): Curve

Defined in: attributes/audio/filters/curve.ts:60

Append a ramp from from to to over duration seconds.

Parameters

from

number

to

number

duration

number

opts?
ease?

EasingFunction

Returns

Curve


resolve()

resolve(clipDuration, defaultValue): ResolvedSegment[]

Defined in: attributes/audio/filters/curve.ts:96

Resolve relative segments into absolute (clip-relative) keyframes once the clip's duration is known.

  • Explicit segment durations are summed; a single bare hold() absorbs the leftover clipDuration - sumOfExplicit so fade-in/hold/fade-out auto-sizes.
  • The final segment's end lands exactly at clipDuration (end-anchor), which is what makes fadeOut "the last N seconds" without naming an anchor.
  • If explicit durations exceed clipDuration, the schedule is clamped to the clip (later segments may be squeezed to zero) and a dev warning is logged.

Parameters

clipDuration

number

defaultValue

number

value used for an unresolved first from (the param's natural value).

Returns

ResolvedSegment[]


sampleAt()

sampleAt(t, clipDuration, defaultValue): number

Defined in: attributes/audio/filters/curve.ts:173

Sample the curve's value at relative time t seconds (for a known clip duration).

Parameters

t

number

clipDuration

number

defaultValue

number

Returns

number


staticValue()

staticValue(defaultValue): number

Defined in: attributes/audio/filters/curve.ts:188

The curve's value at t=0 — its constant fallback for static contexts.

Parameters

defaultValue

number

Returns

number