CameraStart |
public void StartRotation( float headingChangeInSecond, float attitudeChangeInSecond, float accelerationSpeed, Func<float, float>? easingFunction )
StartRotation method slowly starts the camera rotation (animating Heading and Attitude properties) and than accelerates the rotation.
To immediately start rotation for this camera, use the StartRotation(Single, Single) method.
The animation can be stopped with StopRotation or StopRotation(Single, FuncSingle, Single) methods.
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.
When StartRotation is called when the rotation is already animated, StopRotation will be called and than the animation will start again.
When the camera is controller by a CameraController, the CameraController can suspend animation when user is controlling the camera. After the user stops controlling the camera the animation can be resumes.
Controlling the acceleration speed
The acceleration speed is configured by accelerationSpeed and easingFunction parameters.
accelerationSpeed 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> (takes time as float as parameter and returns eased time as 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:
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); }