Skip to main content

Function: replace()

replace(fromElement: ReactiveElementBase | DOMElement, toElement: ReactiveElementBase | DOMElement, options?: object): ReplaceTransition

Creates an in-place element replacement transition swapping two elements smoothly without ghosting.

Parameters​

ParameterTypeDescription
fromElementReactiveElementBase | DOMElement-
toElementReactiveElementBase | DOMElement-
options?{ duration?: number; ease?: BuiltinEase | EaseCurve; matchPosition?: boolean; overlap?: number; scale?: number | boolean; }-
options.duration?numberTotal choreography duration in seconds (default: 0.5s).
options.ease?BuiltinEase | EaseCurveEasing curve for the incoming element (default: "quartOut").
options.matchPosition?booleanAutomatically match incoming element's (x, y) coordinates to outgoing element (default: true).
options.overlap?numberOverlap hand-off point as a fraction of exit progress (default: 0.55).
options.scale?number | booleanSubtle depth scaling factor during swap (default: 0.96, or false to disable).

Returns​

ReplaceTransition