Click or drag to resize
Ab4d.SharpEngine logo

IRotatingCameraStopRotation(Single, FuncSingle, Single) Method

StopRotation slowly stops the rotation animation of the camera with preserving the rotation inertia.

Namespace: Ab4d.SharpEngine.Cameras
Assembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 2.0.8956+4c7684e186ca1be74e7a284fbe739d9a1b843d3c
Syntax
C#
void StopRotation(
	float decelerationSpeed,
	Func<float, float>? easingFunction
)

Parameters

decelerationSpeed  Single
number of degrees the velocity will change per one second
easingFunction  FuncSingle, Single
if not null the delegate will be used to ease the deceleration value
Remarks

StopRotation slowly stops the animation of the camera with preserving the rotation inertia.

To check if the camera is currently being rotated, see the value of the IsRotating property. Note that after calling StopRotation(Single, FuncSingle, Single) method and specifying the decelerationSpeed, the IsRotating is still true until the camera rotation is stopped.

The animation can be started with StartRotation(Single, Single) or StartRotation(Single, Single, Single, FuncSingle, Single) methods.

The inertia is configured by decelerationSpeed and easingFunction parameters.

decelerationSpeed specifies the number of degrees the velocity will change per one second.

easingFunction can be set to null to disable easing or set to a delegate of type Func<float, float> to specify the easing function.

Some of the most common easing functions are defined in the EasingFunctions class. For example the CubicEaseInOutFunction(Single) is defined by the following code:

C#
public static float CubicEaseInOutFunction(float x)
{
    t *= 2;

    if (t < 1)
        return t * t * t * 0.5f;

    t -= 2;
    return 0.5f * (t * t * t + 2);
}

See Also