Voltray Engine Docs
Loading...
Searching...
No Matches
CameraAnimator Class Reference

Handles smooth camera transitions and animations. More...

#include <CameraAnimator.h>

Public Types

enum class  EasingType {
  Linear , EaseInOut , EaseIn , EaseOut ,
  EaseInOutQuad , EaseInOutCubic
}
 Set the easing function type. More...
 

Public Member Functions

 CameraAnimator (BaseCamera &camera)
 Constructor.
 
void Update (float deltaTime)
 Update the animation - call this every frame.
 
void FocusOnPosition (const Vec3 &targetPosition, float duration=1.0f, std::function< void()> onComplete=nullptr)
 Smoothly focus the camera on a target position.
 
void MoveTo (const Vec3 &newPosition, const Vec3 &newTarget, float duration=1.0f, std::function< void()> onComplete=nullptr)
 Smoothly move camera to a new position and target.
 
bool IsAnimating () const
 Check if any animation is currently active.
 
void StopAnimation ()
 Stop any current animation.
 
void SetEasingType (EasingType type)
 Set the easing type for animations.
 

Detailed Description

Handles smooth camera transitions and animations.

This utility class provides smooth interpolated movements for camera operations like focusing on objects, transitioning between positions, and other animated camera behaviors.

Member Enumeration Documentation

◆ EasingType

enum class CameraAnimator::EasingType
strong

Set the easing function type.

Enumerator
Linear 
EaseInOut 
EaseIn 
EaseOut 
EaseInOutQuad 
EaseInOutCubic 

Constructor & Destructor Documentation

◆ CameraAnimator()

CameraAnimator::CameraAnimator ( BaseCamera camera)

Constructor.

Parameters
cameraReference to the camera to animate

Member Function Documentation

◆ FocusOnPosition()

void CameraAnimator::FocusOnPosition ( const Vec3 targetPosition,
float  duration = 1.0f,
std::function< void()>  onComplete = nullptr 
)

Smoothly focus the camera on a target position.

Parameters
targetPositionThe position to focus on
durationHow long the animation should take (in seconds)
onCompleteOptional callback when animation completes

◆ IsAnimating()

bool CameraAnimator::IsAnimating ( ) const
inline

Check if any animation is currently active.

Returns
True if animating, false otherwise

◆ MoveTo()

void CameraAnimator::MoveTo ( const Vec3 newPosition,
const Vec3 newTarget,
float  duration = 1.0f,
std::function< void()>  onComplete = nullptr 
)

Smoothly move camera to a new position and target.

Parameters
newPositionNew camera position
newTargetNew camera target
durationHow long the animation should take (in seconds)
onCompleteOptional callback when animation completes

◆ SetEasingType()

void CameraAnimator::SetEasingType ( EasingType  type)
inline

Set the easing type for animations.

Parameters
typeThe easing type to use

◆ StopAnimation()

void CameraAnimator::StopAnimation ( )

Stop any current animation.

◆ Update()

void CameraAnimator::Update ( float  deltaTime)

Update the animation - call this every frame.

Parameters
deltaTimeTime elapsed since last frame in seconds

The documentation for this class was generated from the following files: