effect-motion
API Referenceeffect-motionNamespacesMotionVariables

fade

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

Variable: fade

const fade: <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:711

Like fadeTo, but starting from an explicit opacity.

Remarks

The fade-in idiom: entities are born fully opaque, so fadeTo(1) alone would be a no-op. Stating the origin is what makes an entrance possible without first writing opacity: 0 at instantiate time.

Param

from

Starting opacity, 0 to 1.

Param

to

Target opacity, 0 to 1.

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

Fade a caption in from nothing.

yield* caption.pipe(Motion.fade(0, 1, "500 millis"));

On this page