@motion-script/core / TextSelection
Class: TextSelection
Defined in: nodes/text/text-selection.ts:65
A sub-range of a Text node's glyphs that can be animated
independently. Returned by the node's selector methods (find, match,
line, word, words, slice, filter).
Implements AnimationTarget so selection.to({ ... }, duration)
plugs straight into the existing AnimationBuilder / parallel / sequence
machinery — each tween writes resolved values into overrides, which
the node reads when splitting its text into rendered pieces.
Example
yield* textRef().find("hello").to({ opacity: 0.5, y: -10 }, 1);
Implements
Constructors
Constructor
new TextSelection(
node,ranges):TextSelection
Defined in: nodes/text/text-selection.ts:76
Parameters
node
ranges
Returns
TextSelection
Properties
node
readonlynode:Text
Defined in: nodes/text/text-selection.ts:66
overrides
readonlyoverrides:SelectionOverrides
Defined in: nodes/text/text-selection.ts:74
Current resolved overrides for this selection. Numeric fields default to
the node's current values (so a partial tween starts from the node's
style); fill/stroke start as null (inherit) until tweened.
ranges
readonlyranges:TextRange[]
Defined in: nodes/text/text-selection.ts:67
Accessors
isIdentity
Get Signature
get isIdentity():
boolean
Defined in: nodes/text/text-selection.ts:94
True when this selection has no overrides differing from the node default.
Returns
boolean
Methods
_prepareStep()
_prepareStep(
to,duration,easing?):TweenStepper
Defined in: nodes/text/text-selection.ts:123
Resolve one to() step into a flat TweenStepper. Numeric props
(opacity/x/y/scale/rotation/fontWeight/letterSpacing) interpolate
directly; fill/stroke resolve their target once and lerp via the
shared fill/stroke array lerps — mirroring Node._prepareStep.
Parameters
to
Partial<TextSelectionProps>
duration
number
easing?
Returns
Implementation of
_toGen()
_toGen(
to,duration,easing?):FrameGenerator
Defined in: nodes/text/text-selection.ts:173
Parameters
to
Partial<TextSelectionProps>
duration
number
easing?
Returns
Implementation of
to()
to(
to,duration,easing?):AnimationBuilder<TextSelectionProps>
Defined in: nodes/text/text-selection.ts:109
Parameters
to
Partial<TextSelectionProps>
duration
number