OH_ArkUI_Curve_CreateSpringCurve

Function OH_ArkUI_Curve_CreateSpringCurve 

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

Creates a spring curve. The curve shape is subject to the spring parameters, and the animation duration is subject to the duration parameter in animation and animateTo.

§Arguments

  • velocity - Indicates the initial velocity of the spring. It is applied by external factors to the spring animation, designed 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.

Available since API-level: 12