effect-motion
API Referenceeffect-motionNamespacesMotionVariables

rotate

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

Variable: rotate

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

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

Like rotateTo, but starting from an explicit rotation (radians).

Param

from

Starting angle: an in-plane spin, or Euler channels (omitted channels start at the current value).

Param

to

Target angle: an in-plane spin, or Euler channels (omitted channels 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.

Example

Flip a card in: from edge-on to facing the viewer.

yield* card.pipe(
	Motion.rotate({ y: Math.PI / 2 }, { y: 0 }, "500 millis", "easeOutCubic"),
);

On this page