arkui_sys::native_animate

Function OH_ArkUI_Curve_CreateInterpolatingSpring

Source
pub unsafe extern "C" fn OH_ArkUI_Curve_CreateInterpolatingSpring(
    velocity: f32,
    mass: f32,
    stiffness: f32,
    damping: f32,
) -> ArkUI_CurveHandle
Available on crate feature api-12 only.
Expand description

Creates an interpolating spring curve animated from 0 to 1. The actual animation value is calculated based on the curve.

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

§Arguments

velocity - Indicates the initial velocity of the spring. It is applied by external factors to the spring animation, esigned to help ensure the smooth transition from the previous motion state. The velocity is the normalized velocity, and its value is equal to the actual velocity at the beginning of the animation divided by the animation attribute change value.

mass - Indicates the mass, which influences the inertia in the spring system. The greater the mass, the greater the amplitude of the oscillation, and the slower the speed of restoring to the equilibrium position.

stiffness - Indicates the stiffness. It is the degree to which an object deforms by resisting the force applied. In an elastic system, the greater the stiffness, the stronger the ability to resist deformation, and the faster the speed of restoring to the equilibrium position.

damping - Indicates the damping. It is used to describe the oscillation and attenuation of the system after being disturbed. The larger the damping, the smaller the number of oscillations of elastic motion, and the smaller the oscillation amplitude.

§Returns

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