arkui_sys::native_animate

Function OH_ArkUI_Curve_CreateSpringMotion

Source
pub unsafe extern "C" fn OH_ArkUI_Curve_CreateSpringMotion(
    response: f32,
    dampingFraction: f32,
    overlapDuration: f32,
) -> ArkUI_CurveHandle
Available on crate feature api-12 only.
Expand description

Creates a spring animation curve. If multiple spring animations are applied to the same attribute of an object, each animation replaces their predecessor and inherits the velocity.

Note:** The animation duration is subject to the curve parameters, rather than the duration parameter in animation or animateTo.

§Arguments

response - Indicates the duration of one complete oscillation.

dampingFraction - Indicates the damping coefficient.

0 and < 1: underdamped. In this case, the spring overshoots the equilibrium position. 1: critically damped. 1: overdamped. In this case, the spring approaches equilibrium gradually.

overlapDuration - Indicates the duration for animations to overlap. When animations overlap, the response values of these animations will transit smoothly over this duration if they are different.

§Returns

Returns the pointer to the interpolation object of the curve. Returns NULL if a parameter error occurs.