effect-motion
API Referenceeffect-motionNamespacesMotionVariables

scaleTo

const scaleTo: <Tag>(to, duration, timing?) => <E, R>(instance) => Effect<Instance<Tag>, E, Runner | R> & <Tag, E, R>(instance, to, duration, timing?)

Variable: scaleTo

const scaleTo: <Tag>(to, duration, timing?) => <E, R>(instance) => Effect<Instance<Tag>, E, Runner | R> & <Tag, E, R>(instance, to, duration, timing?) => Effect<Instance<Tag>, E, Runner | R>;

Defined in: packages/motion/src/Motion.ts:779

Scale an instance to to over duration, starting from its current scale.

Remarks

Scale multiplies the entity's size about its position (its anchor — the center for centered shapes) without touching its size fields, so it composes: scaling a Group scales its whole subtree, children's own scales included. 1 is natural size and 0 collapses it — the usual "pop in" starts from 0.

Param

to

A uniform factor, or per-axis factors (omitted axes hold).

Param

duration

How long, in scene time.

Param

timing

An easing name or function.

Default Value

timing — "linear"

Returns

The instance, so animators chain.

See

scale to start from an explicit scale.

Example

A scale punch: overshoot, then settle back to natural size.

yield* logo.pipe(
	Motion.scaleTo(1.2, "150 millis", "easeOutQuad"),
	Motion.scaleTo(1, "250 millis", "easeInOutQuad"),
);

On this page