calculate

Commons
stable

Compute the position (centerX, centerY), radius, and initial scale of a ripple effect from a pointer or keyboard event on a target element.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

e
required
TRippleEvent
The triggering event (MouseEvent, TouchEvent, or KeyboardEvent). Keyboard events produce a centered ripple.
el
required
IRippleHtmlElement
The host element extended with ripple state (_ripple). Used to obtain dimensions and configuration.
value
IRippleOptions
{}
Optional ripple options (center flag, circle mode). When center is true, the ripple always originates from the element center.

API

Return value

The value returned by this util.

Geometry values used to position and size the ripple pseudo-element via CSS custom properties.

Usage

Examples

Ready-to-paste usage snippets.

Calculate ripple geometry from a click

typescript